New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symlinks in chroot #333

Closed
telefax opened this Issue Jul 23, 2018 · 5 comments

Comments

Projects
None yet
3 participants
@telefax
Copy link

telefax commented Jul 23, 2018

Would it be possible to have a configuration option where you specify the symlink root?

my httpd daemon runs chrooted and the symlinks contains the full path (which the chroot doesn't know anything about).

Thanks!

@telefax

This comment has been minimized.

Copy link
Author

telefax commented Jul 24, 2018

So, instead of linking to /mnt/some_mountpoint/www/images/ it would link relative to the chroot, such as /www/images/ or so.

@saimn

This comment has been minimized.

Copy link
Owner

saimn commented Jul 31, 2018

I understand that this behavior can be annoying, but I'm a bit reluctant to add such a specific option ... Another solution is to deactivate symlink, if your gallery is not too big the cost is small enough.

@klnavajo

This comment has been minimized.

Copy link

klnavajo commented Aug 21, 2018

I have the same problem when using the option use_orig = True. Links are not relatives (but absolute path), so, images and site directories are not portable.

Perhaps a solution (utils.py) :

def copy(src, dst, symlink=False):
    """Copy or symlink the file."""
    func = os.symlink if symlink else shutil.copy2
    if symlink and os.path.lexists(dst):
        os.remove(dst)
    if symlink:  # relative symlink from dst
        func(os.path.relpath(src, os.path.dirname(dst)), dst)
    else:
        func(src, dst)
@saimn

This comment has been minimized.

Copy link
Owner

saimn commented Aug 26, 2018

Links are not relatives (but absolute path), so, images and site directories are not portable.

Yes, but I guess that relative paths would not be so practical in many cases, as you would need to keep the same directory structure or copy the src directory with the destination one. Maybe a solution could be an option to use hardlinks, to save space on the computer building the gallery but keeping a destination directory that can be easily moved or copied ?

@klnavajo

This comment has been minimized.

Copy link

klnavajo commented Aug 28, 2018

Hi, the solution of an option and hardlink, that sounds good :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment