-
Notifications
You must be signed in to change notification settings - Fork 23
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
scrub crashes when called with "-D somename" flag on symlink to regular file #18
Comments
Thanks! I can reproduce this with the current master. Not that it probably matters, but which version of scrub is this? (scrub -v) |
scrub version 2.6.1 |
Just refreshing my memory on how this should work - see if you agree: Normal behavior should be to scrub the link target (the file). If -D is added, the target should be renamed. If -r is added, the target should be removed. The symlink is left as-is. If the symlink itself is to be scrubbed, then -L should be specified. In that case, the link target is ignored. If no other options, it's an error. If -D, the symlink is renamed. If -r the symlink is removed. Does that make sense? |
It's really not an easy question, but I think it's best choice - maybe this behaviour is not the only possible, but it keeps it's logic when operating on symlink chain. |
Hmm, good thoughts. Thank you! |
Btw, maybe it'll be good to permit to scrub the name of any file, not just symlink. So, -D -L scrubs name in either case, scrubs content of target if it is a regular file, and then removes target if -r is added. This'll make sense to 'scrub -L -D sometmpname -r /path/to/named_pipe' and even 'scrub -L -D sometmpname -r /path/to/', (permitting to delete empty directory only, to avoid decisions what to do if directory is not empty). |
That seems reasonable. Note this issue may sit here for a while, as I'm currently working on another project that is a higher priority for me. |
Ofcoz! Free software is free, and it's more than enough. Noone can expect 24x7 full support. |
I'm sorry, I should have tested this first. I am not seeing this bug anymore. What happens is that the link is removed, but not the link target. It seems the solution is to do two directory renames, and two removals.
Now, the original symlink is removed, but the target remains not renamed. Now perhaps, after the link is renamed and removed, a second renaming and removal of the link target can be achieved. But I'll leave that for now. =-=-=-= Original follows This has been languishing for a while. I think a better way is to NOT permit certain actions on a symlink. For example, a link is not a regular file, so the assertion in the |
It appears that 499a491 fixed the particular assertion reported in this issue (tested by reverting and retrying the reproducer). So that answers one question I had. |
When I call "scrub -D somename" on symlink, scrub crashes after wiping a file; symlink not renamed. If "-r" flag get added, scrub crashes too, and neither destination file nor symlink removed.
How to reproduce:
$ echo "test" > a
$ ln -s a b
$ scrub -r -D scrubbed b
...
scrub: scrub.c:625: scrub_dirent: Assertion `ftype == FILE_REGULAR' failed.
Abort (core dumped)
$
The text was updated successfully, but these errors were encountered: