Skip to content
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

Removing a symlink looks like removing its target #41

Open
fangism opened this issue Mar 15, 2021 · 8 comments
Open

Removing a symlink looks like removing its target #41

fangism opened this issue Mar 15, 2021 · 8 comments

Comments

@fangism
Copy link

fangism commented Mar 15, 2021

Removing a symbolic link looks like removing the link's destination (but perhaps should not?).

Demonstration:

$ touch foo
$ ln -s foo bar
$ fsatrace erwdtmq /dev/stdout -- rm -f bar
r|/usr/bin/rm
q|/home/fangism/foo
d|/home/fangism/foo

Destination foo is unaffected.

I expected something more like:

r|/usr/bin/rm
q|/home/fangism/bar
d|/home/fangism/bar
@fangism
Copy link
Author

fangism commented Mar 15, 2021

This is on linux. Not sure if it looks the same on other platforms.

@jacereda
Copy link
Owner

What would be the expected behaviour from a build system perspective? I would assume queries/reads should follow symlinks but deletes shouldn't, what do you think?

@jacereda
Copy link
Owner

jacereda commented Apr 4, 2021

@fangism ping

@fangism
Copy link
Author

fangism commented Apr 4, 2021

[Sorry, I've been out for a few weeks.]

From the original comment, this might seem more reasonable:

$ touch foo
$ ln -s foo bar
$ fsatrace erwdtmq /dev/stdout -- rm -f bar
r|/usr/bin/rm
q|/home/fangism/bar
d|/home/fangism/bar

But I haven't dug into the details of how operations on symlinks are traced.

@jacereda
Copy link
Owner

jacereda commented Apr 5, 2021

If queries/reads don't follow symlinks that would put a burden on the build system. The one I'm using would certainly need to be modified to take into account this fact.

I propose to report the symlink only when deleting, reporting the linked file elsewhere. Do you have any example of a situation where this would be a problem in a build system?

@fangism
Copy link
Author

fangism commented Apr 5, 2021

Using the above rm example, what would your proposed trace look like?

@jacereda
Copy link
Owner

jacereda commented Apr 5, 2021

r|/usr/bin/rm
q|/home/fangism/foo
d|/home/fangism/bar

@fangism
Copy link
Author

fangism commented Apr 5, 2021

r|/usr/bin/rm
q|/home/fangism/foo
d|/home/fangism/bar

This is an improvement, and should let us proceed further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants