Patch to avoid circular link problem with downloads
Andy Gibbs
andyg1001@hotmail.co.uk
Tue Jun 15 16:21:00 GMT 2010
Hi,
I've come across some odd behaviour inside crosstool-ng 1.7.0, which I've
patched in the attached file, in case it is something that should be
fixed...
In my configuration, I'm saving the downloaded files to a local directory,
but crosstool seems to sometimes get out of sync with itself when restarting
again later. The outcome was that the files in the saved downloads folder
were becoming circular links.
It took a little while to work out what was happening: crosstool was
ordinarily downloading the file to the tarballs folder, then deleting the
file in the saved downloads and creating a link from there to the tarballs
folder. Where it went wrong was if something caused the download to fail (I
didn't manage to track exactly why this happened, sorry!), but there was
still the link from the tarballs folder to the saved downloads folder from a
previous time. This was then being moved to the saved downloads folder and
thus causing the circular link.
I hope this description makes sense!!!
Anyway, the attached patch provides an easy work-around. What the patch
does is changes how the CT_SaveLocal function works. Instead of always
moving the file from the tarballs directory to the saved downloads
directory, it first checks to see whether the file is actually already the
link to a file in the saved downloads directory. Only if it isn't will it
then do the swap. I've used the 'readlink' function in order to correctly
determine the path both of the file and the target folder in order to expand
out all symbolic links and any '..'s and ensure a proper comparison.
I hope this helps make crosstool even better! I've tested the patch
*fairly* thoroughly, and I believe it shouldn't otherwise break things. :o)
Cheers
Andy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: functions.diff
Type: application/octet-stream
Size: 817 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/crossgcc/attachments/20100615/b52202de/attachment.obj>
-------------- next part --------------
--
For unsubscribe information see http://sourceware.org/lists.html#faq
More information about the crossgcc
mailing list