Hello,
I found another task where I want to contribute, the issue with 45037.
For what I understand, and read in the mailling list, the problem occur inftp.c
ftp_loop_internal -> remove_link.
But what I don't understand, is why each time he try to remove
the symbolic link. What is the purpose of this statement, in overall context of
code.
As Tim pointed out, the purpose is not to overwrite the content of the file the
link points to.
If README was a regular file and then you passed "-O README", it's okay to
overwrite it (I don't
know what's Wget default behavior here, if it prompts the user or whatever),
because the user is supposed
to be aware of such action. But if README was a symlink, passing "-O README"
could be a malicious
action, as Angel said. If you want an example of such an action and its
consequences,
google for "Symlink race".
That was here, because that was a feature, and now a bug, because some others
statements was removed ?
If for example I have a symbolic link README in local, and try to download
another file, with the
same name README remotely, with -O foo, normally, my symbolic link README
should not be modified.
Exactly. Looking at the code, my guess is that the person who wrote it didn't
take into account that
the user could have passed the "-O" option (or maybe it wasn't yet implemented
then, who knows). He or she
just picked the name of the downloaded file.
But now if I pass -O README, the symbolic link will be removed because it's a
redirection ?
so It's not possible to just renamed it ?
It sounds like that's exactly what should be done. Treat the symlink as if it
was a local file: if a symlink
exists with the same name as the downloaded file, rename the downloaded file to
README.1, for instance.