[Bug 705308] New: etags (in ctags package) corrupts file names when normalising them.
https://bugzilla.novell.com/show_bug.cgi?id=705308 https://bugzilla.novell.com/show_bug.cgi?id=705308#c0 Summary: etags (in ctags package) corrupts file names when normalising them. Classification: openSUSE Product: openSUSE 11.4 Version: Factory Platform: x86-64 OS/Version: Other Status: NEW Severity: Normal Priority: P5 - None Component: Basesystem AssignedTo: puzel@novell.com ReportedBy: nfbrown@novell.com QAContact: qa@suse.de CC: aj@suse.de Found By: --- Blocker: --- If I run etags `find . -name '*.[ch]'` to generate a TAGS file for all source in a directory tree the resulting TAGS file will be corrupted. The corruption happens as part of normalising the file name - files will be given as e.g. ./dir/file.c and etags wants to use "dir/file.c" in the TAGS file. The 'absolule_filename' function is used as part of the normalisation. When it finds "/./" in the path name it uses: strcpy(slashp, slashp+2) to make the "./" disappear. This is not allowed and does not work reliably. The documentation for strcpy says explicitly "The strings may not overlap" but in this case they do. This sometimes works with the current glibc but sometimes doesn't. In particular if "slashp" is a multiple of 16 plus 3, it doesn't work. The following sample code reliably prints "inclede" where you would expect "include" #include <malloc.h> #include <stdlib.h> #include <string.h> main(int argc, char *argv) { char *b = malloc(64); strcpy(b, "..././support/include/sockaddr.h"); strcpy(b+3, b+5); write(1, b, strlen(b)); write(1, "\n", 1); exit(0); } One could argue that glibc is at fault here for being too clever, but as the strcpy documentation is explicit, we should probably fix etags. The simplest fix would be to define: static void etags_strcpy(char *to, char *from) { while (*from) { *to++ = *from++; } *to = *from; } and use that where ever there might be an overlap. (Adding Andreas as you seem to be the maintainer of glibc - just to keep you informed.) -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=705308 https://bugzilla.novell.com/show_bug.cgi?id=705308#c Petr Uzel <puzel@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P5 - None |P3 - Medium Status|NEW |ASSIGNED -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=705308 https://bugzilla.novell.com/show_bug.cgi?id=705308#c1 Petr Uzel <puzel@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |NEEDINFO InfoProvider| |nfbrown@novell.com --- Comment #1 from Petr Uzel <puzel@novell.com> 2011-08-02 15:37:51 UTC --- Thanks for the analysis, Neil. I have just submitted the fix to Factory (sr#77700). Do you also wish maintenance update for 11.3 and 11.4 ? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=705308 https://bugzilla.novell.com/show_bug.cgi?id=705308#c2 Neil Brown <nfbrown@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |ASSIGNED InfoProvider|nfbrown@novell.com | --- Comment #2 from Neil Brown <nfbrown@novell.com> 2011-08-02 21:32:56 UTC --- Thanks! I'm quite happy with a Factory fixing - nothing more needed from my perspective. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=705308 https://bugzilla.novell.com/show_bug.cgi?id=705308#c3 Petr Uzel <puzel@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED --- Comment #3 from Petr Uzel <puzel@novell.com> 2011-08-03 07:45:37 UTC --- Thanks Neil, closing. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com