net-misc/atftp-0.7 builds and works on amd64
Does not work for me: [21:36:16 thanatos] root# atftp localhost tftp> dir Segmentation fault [21:36:23 thanatos] root#
I have checked atftpd (server) only. And now checking client: bash-2.05b# atftp localhost tftp> So it seems OK.
I got that far too. Notice it didn't segfault until I tried to run a command.
Sorry! Didn't notice next command. So from my box: bash-2.05b# atftp localhost tftp> dir tftp: bad command name. tftp> status Connected: localhost port 69 Mode: octet Verbose: off Trace: off Options tsize: disabled blksize: disabled timeout: disabled multicast: disabled mtftp variables client-port: 76 mcast-ip: 0.0.0.0 listen-delay: 2 timeout-delay: 2 Last command: dir So still it is OK.
Okay, I did very little to test. Just created /tftproot and touched a file there, so maybe I messed something else up.
This seems to work OK for me so far. I did the following: # emerge atftp # mkdir /tftproot # /etc/init.d/atftp start # dd if=/dev/zero of=/tftproot/zerofile.dat bs=1 count=1000 (this creates a dummy 1000 byte file of 0's for testing purposes) # atftp localhost # get zerofile.dat # quit I end up with the zerofile.dat file in my cwd. FWIW, the atftp client does not support the 'dir' command. Other commands seem to work OK for me. Here is my emerge --info output: orange ~ # emerge --info Portage 2.0.51-r15 (default-linux/amd64/2004.3, gcc-3.4.3, glibc-2.3.4.20041102-r0, 2.6.10-gentoo-r7 x86_64) ================================================================= System uname: 2.6.10-gentoo-r7 x86_64 AMD Athlon(tm) 64 Processor 3200+ Gentoo Base System version 1.6.9 Python: dev-lang/python-2.3.4-r1 [2.3.4 (#1, Feb 7 2005, 14:26:21)] dev-lang/python: 2.3.4-r1 sys-devel/autoconf: 2.59-r6, 2.13 sys-devel/automake: 1.7.9-r1, 1.8.5-r3, 1.5, 1.4_p6, 1.6.3, 1.9.4 sys-devel/binutils: 2.15.92.0.2-r1, 2.15.92.0.2-r2 sys-devel/libtool: 1.5.10-r4 virtual/os-headers: 2.6.8.1-r3 ACCEPT_KEYWORDS="amd64 ~amd64" AUTOCLEAN="yes" CFLAGS="-march=athlon64 -O3 -pipe -ffast-math -funit-at-a-time -ftracer -fpeel-loops -funswitch-loops -fomit-frame-pointer -mfpmath=sse" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-march=athlon64 -O3 -pipe -ffast-math -funit-at-a-time -ftracer -fpeel-loops -funswitch-loops -fomit-frame-pointer -mfpmath=sse" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs autoconfig ccache distlocks sandbox" GENTOO_MIRRORS="http://gentoo.mirrors.pair.com http://gentoo.osuosl.org http://www.ibiblio.org/pub/Linux/distributions/gentoo" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="amd64 X Xaw3d aalib acpi alsa arts audiofile avi berkdb bitmap-fonts bonobo cddb cdparanoia cdr crypt cups directfb doc dvd dvdr encode esd f77 fam fbcon flac font-server foomaticdb fortran gcj gdbm gif gimpprint gnome gnustep gphoto2 gpm gstreamer gtk gtk2 gtkhtml guile imagemagick imlib immqt innodb ipv6 java jikes jp2 jpeg jpeg2k junit kde lcms ldap libwww lzw lzw-tiff mad mmap motif mozilla mpeg mule multilib mysql ncurses nls nptl objc oggvorbis opengl oss pam pcre pda perl pic png postgres ppds pslib python qt readline ruby scanner sdl slang speex sqlite ssl svg tcltk tcpd tetex tiff truetype truetype-fonts type1-fonts unicode usb userlocales vim-with-x xface xine xinerama xml xml2 xmms xpm xprint xrandr xv zlib" Unset: ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS, PORTDIR_OVERLAY Not sure if this warrants a TESTED keyword, since others are reporting problems. I would vote in favor of it, though. I cannot reproduce the segfault.
Update, since mine is the one failing. emerge atftp mkdir /tftproot /etc/init.d/atftp start dd if=/dev/zero of=/tftproot/zerofile.dat bs=1 count=1000 atftp localhost tftp> get zerofile.dat Segmentation fault Indeed, anything I type at the tftp> prompt results in a segfault. The segfault is in /lib/tls/libc.so.6, in strlen() emerge info: Portage 2.0.51-r15 (default-linux/amd64/2005.0, gcc-3.4.3, glibc-2.3.4.20050125-r0, 2.6.9-gentoo-r14 x86_64) ================================================================= System uname: 2.6.9-gentoo-r14 x86_64 AMD Athlon(tm) 64 Processor 3000+ Gentoo Base System version 1.4.16 Python: dev-lang/python-2.3.4-r1 [2.3.4 (#1, Feb 7 2005, 11:48:09)] distcc 2.18.3 x86_64-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled] dev-lang/python: 2.3.4-r1 sys-devel/autoconf: 2.13, 2.59-r6 sys-devel/automake: 1.5, 1.8.5-r3, 1.6.3, 1.7.9-r1, 1.4_p6, 1.9.4 sys-devel/binutils: 2.15.92.0.2-r1 sys-devel/libtool: 1.5.10-r4 virtual/os-headers: 2.6.8.1-r4 ACCEPT_KEYWORDS="amd64" AUTOCLEAN="yes" CFLAGS="-march=k8 -O2 -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-march=k8 -O2 -pipe" DISTDIR="/home/portage/distfiles" FEATURES="autoaddcvs autoconfig ccache distlocks sandbox" GENTOO_MIRRORS="http://apollo.fprintf.net" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/home/portage" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/home/portage/overlays/ebuilds" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="amd64 X aac aalib acpi alsa apache2 artworkextra avi bash-completion berkdb bitmap-fonts cdr crypt cscope cups db2 dbus dga directfb divx4linux dlloader dvd eds encode esd ethereal evo f77 fam flac font-server foomaticdb gcj gd gdbm gif gimpprint gnome gnutls gphoto2 gpm gstreamer gtk gtk2 gtkhtml guile hal howl imagemagick imap imlib ipv6 jabber java jp2 jpeg ldap lesstif libg++ libwww lzo lzw lzw-tiff mad matroska mikmod mime mmap mng motif mozilla mpeg mpi ncurses nls nptl offensive oggvorbis opengl oscar oss pam pcmcia pda pdflib perl png python qemu-fast quicktime readline real rtc samba sdl sharedmem slang slp soap softmmu speex spell ssl svg tcpd theora tiff truetype truetype-fonts type1-fonts unicode usb userlocales wmf xface xml2 xpm xprint xrandr xsl xv xvid zlib" Unset: ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS
Hrm, I wonder if this is a problem with glibc-2.3.4.20050125? That is the only obvious difference I am seeing between your system and mine. Might be worth a try to downgrade to glibc-2.3.4.20041102, and see if this works?
I can't downgrade, as an emerge of glibc-2.3.4.20041102 fails.
OK, I synced up my portage tree today, and pulled in the update for glibc-2.3.4.20050125, which has recently been keyworded ~amd64. atftp-0.7 still worked OK for me against the newer glibc. I even reemerge atftp-0.7, just to check it. Everything is fine, I ran the same steps I outlined above to test this. Here is my updated emerge --info output: orange ~ # emerge --info Portage 2.0.51-r15 (default-linux/amd64/2004.3, gcc-3.4.3, glibc-2.3.4.20050125-r0, 2.6.10-gentoo-r7 x86_64) ================================================================= System uname: 2.6.10-gentoo-r7 x86_64 AMD Athlon(tm) 64 Processor 3200+ Gentoo Base System version 1.6.9 Python: dev-lang/python-2.3.4-r1 [2.3.4 (#1, Feb 7 2005, 14:26:21)] dev-lang/python: 2.3.4-r1 sys-devel/autoconf: 2.59-r6, 2.13 sys-devel/automake: 1.7.9-r1, 1.8.5-r3, 1.5, 1.4_p6, 1.6.3, 1.9.4 sys-devel/binutils: 2.15.92.0.2-r1, 2.15.92.0.2-r2 sys-devel/libtool: 1.5.10-r4 virtual/os-headers: 2.6.8.1-r3 ACCEPT_KEYWORDS="amd64 ~amd64" AUTOCLEAN="yes" CFLAGS="-march=athlon64 -O3 -pipe -ffast-math -funit-at-a-time -ftracer -fpeel-loops -funswitch-loops -fomit-frame-pointer -mfpmath=sse" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-march=athlon64 -O3 -pipe -ffast-math -funit-at-a-time -ftracer -fpeel-loops -funswitch-loops -fomit-frame-pointer -mfpmath=sse" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs autoconfig ccache distlocks sandbox" GENTOO_MIRRORS="http://gentoo.mirrors.pair.com http://gentoo.osuosl.org http://www.ibiblio.org/pub/Linux/distributions/gentoo" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="amd64 X Xaw3d aalib acpi alsa arts audiofile avi berkdb bitmap-fonts bonobo cddb cdparanoia cdr crypt cups directfb doc dvd dvdr encode esd f77 fam fbcon flac font-server foomaticdb fortran gcj gdbm gif gimpprint gnome gnustep gphoto2 gpm gstreamer gtk gtk2 gtkhtml guile imagemagick imlib immqt innodb ipv6 java jikes jp2 jpeg jpeg2k junit kde lcms ldap libwww lzw lzw-tiff mad mmap motif mozilla mpeg mule multilib mysql ncurses nls nptl objc oggvorbis opengl oss pam pcre pda perl pic png postgres ppds pslib python qt readline ruby scanner sdl slang speex sqlite ssl svg tcltk tcpd tetex tiff truetype truetype-fonts type1-fonts unicode usb userlocales vim-with-x xface xine xinerama xml xml2 xmms xpm xprint xrandr xv zlib" Unset: ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS, PORTDIR_OVERLAY And here is my short test of atftp: orange ~ # /etc/init.d/atftp start * Starting tftpd ... [ ok ] orange ~ # atftp localhost tftp> get zerofile.dat Overwite local file [y/n]? y tftp> quit orange ~ # ls -l total 15639 drwxr-xr-x 3 root root 104 Feb 8 21:35 Desktop -rw-r--r-- 1 root root 355 Jan 13 03:00 dead.letter -rw-r--r-- 1 root root 1000 Feb 15 11:38 zerofile.dat orange ~ # /etc/init.d/atftp stop * Stopping tftpd ... [ ok ] orange ~ # So it is not really clear to me why you are getting a segfault? I will try updating my profile to 2005.0 next, and see if I can reproduce it that way. FYI, here are the shared lib dependencies for atftp client and server that I get: orange ~ # ldd /usr/sbin/atftpd libpthread.so.0 => /lib/tls/libpthread.so.0 (0x0000002a9566e000) libnsl.so.1 => /lib/libnsl.so.1 (0x0000002a95783000) libwrap.so.0 => /lib/libwrap.so.0 (0x0000002a9589b000) libpcre.so.0 => /usr/lib/libpcre.so.0 (0x0000002a959a4000) libc.so.6 => /lib/tls/libc.so.6 (0x0000002a95ab5000) /lib64/ld-linux-x86-64.so.2 (0x0000002a95556000) orange ~ # orange ~ # ldd /usr/bin/atftp libreadline.so.5 => /lib/libreadline.so.5 (0x0000002a9566e000) libc.so.6 => /lib/tls/libc.so.6 (0x0000002a957ab000) libncurses.so.5 => /lib/libncurses.so.5 (0x0000002a959e4000) /lib64/ld-linux-x86-64.so.2 (0x0000002a95556000) orange ~ # If you can pull up the atftp client in gdb, it might be worthwhile to execute a backtrace ("bt") command when you get the segfault, to shed some light on where the segfault is originating from within atftp.
Well, without debugging options in any of my libraries, it's not a whole lot of use, but here's the backtrace: Program received signal SIGSEGV, Segmentation fault. 0x0000002a95813690 in strlen () from /lib/tls/libc.so.6 (gdb) bt #0 0x0000002a95813690 in strlen () from /lib/tls/libc.so.6 #1 0x0000002a95693143 in add_history () from /lib/libreadline.so.4 #2 0x00000000004022c1 in ?? () #3 0x0000002a957c1798 in __libc_start_main () from /lib/tls/libc.so.6 #4 0x0000000000401eea in ?? () (gdb)
OK, I have managed to run a test system updated to 2005.0. It worked fine for me there, too: neptune ~ # mkdir /tftproot neptune ~ # dd if=/dev/zero of=/tftproot/zerofile.dat bs=1 count=1000 1000+0 records in 1000+0 records out neptune ~ # /etc/init.d/atftp start * Starting tftpd ... [ ok ] neptune ~ # atftp localhost tftp> get zerofile.dat tftp> quit neptune ~ # ls -l zerofile.dat -rw-r--r-- 1 root root 1000 Feb 16 16:15 zerofile.dat neptune ~ # /etc/init.d/atftp stop * Stopping tftpd ... [ ok ] neptune ~ # Here is my emerge --info output from that system: neptune ~ # emerge --info Portage 2.0.51-r15 (default-linux/amd64/2005.0, gcc-3.4.3-20050110, glibc-2.3.4.20050125-r0, 2.6.10-gentoo-r6 x86_64) ================================================================= System uname: 2.6.10-gentoo-r6 x86_64 AMD Opteron(tm) Processor 844 Gentoo Base System version 1.6.9 Python: dev-lang/python-2.3.4-r1 [2.3.4 (#1, Feb 8 2005, 07:26:15)] distcc 2.18.3 x86_64-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled] dev-lang/python: 2.3.4-r1 sys-devel/autoconf: 2.13, 2.59-r6 sys-devel/automake: 1.5, 1.8.5-r3, 1.6.3, 1.7.9-r1, 1.4_p6, 1.9.4 sys-devel/binutils: 2.15.92.0.2-r2 sys-devel/libtool: 1.5.10-r4 virtual/os-headers: 2.6.10 ACCEPT_KEYWORDS="amd64 ~amd64" AUTOCLEAN="yes" CFLAGS="-march=k8 -O3 -pipe -ffast-math -funit-at-a-time -ftracer -fpeel-loops -funswitch-loops -fomit-frame-pointer -mfpmath=sse" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-march=k8 -O3 -pipe -ffast-math -funit-at-a-time -ftracer -fpeel-loops -funswitch-loops -fomit-frame-pointer -mfpmath=sse" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs autoconfig ccache distlocks sandbox" GENTOO_MIRRORS="http://gentoo.mirrors.pair.com http://gentoo.osuosl.org http://www.ibiblio.org/pub/Linux/distributions/gentoo" MAKEOPTS="-j3" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="amd64 X Xaw3d aalib acpi alsa arts audiofile avi berkdb bitmap-fonts cddb cdparanoia cdr crypt cups curl directfb doc dvd dvdr encode esd f77 fam fbcon flac foomaticdb fortran gcj gdbm gif gimpprint gnome gnustep gphoto2 gpm gstreamer gtk gtk2 gtkhtml imagemagick imlib immqt innodb ipv6 java jikes jp2 jpeg jpeg2k junit kde lcms ldap libwww lzw lzw-tiff mad mmap motif mozilla mpeg mule mysql ncurses nls nptl objc oggvorbis opengl oss pam pcre pda perl pic png postgres ppds pslib python qt readline ruby scanner slang speex sqlite ssl svg tcltk tcpd tetex tiff truetype truetype-fonts type1-fonts unicode usb userlocales vim-with-x xface xine xinerama xml xml2 xmms xpm xprint xrandr xv zlib" Unset: ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS, PORTDIR_OVERLAY One thing I noticed from the gdb backtrace was that you seem to be using ncurses.so.4, where I am using ncurses.so.5. Would it be possible to upgrade to ncurses.so.5, and try to emerge atftp against that? It may also be worth reemering readline against ncurses.so.5, too.
I'm assuming you mean libreadline.so.5, as ncurses seems to jump from 4.5 to 8, which is not even stable on x86, and isn't in the backtrace anyway. Still fails for me: Program received signal SIGSEGV, Segmentation fault. 0x0000002a95814690 in strlen () from /lib/tls/libc.so.6 (gdb) bt #0 0x0000002a95814690 in strlen () from /lib/tls/libc.so.6 #1 0x0000002a95693b6c in add_history () from /lib/libreadline.so.5 #2 0x00000000004022c1 in ?? () #3 0x0000002a957c2798 in __libc_start_main () from /lib/tls/libc.so.6 #4 0x0000000000401eea in ?? () (gdb)
Argh, that's what I get for doing two things at once. :) Yes, I had meant libreadline.so.5 when referring to the stackdump from gdb. Sorry for any confusion. However, I am showing that /usr/bin/atftp does indicate a dependency on ncurses: orange ~ # ldd /usr/bin/atftp libreadline.so.5 => /lib/libreadline.so.5 (0x0000002a9566e000) libc.so.6 => /lib/tls/libc.so.6 (0x0000002a957ab000) libncurses.so.5 => /lib/libncurses.so.5 (0x0000002a959e4000) /lib64/ld-linux-x86-64.so.2 (0x0000002a95556000) I am using ncurses-5.4-r5: * sys-libs/ncurses Latest version available: 5.4-r5 Latest version installed: 5.4-r5 Size of downloaded files: 2,103 kB Homepage: http://www.gnu.org/software/ncurses/ncurses.html Description: console display library License: MIT I also see that libreadline.so.5 does indicate a shared library dependency on ncurses as well: orange ~ # ldd /lib/libreadline.so.5 libncurses.so.5 => /lib/libncurses.so.5 (0x0000002a956ad000) libc.so.6 => /lib/tls/libc.so.6 (0x0000002a9580c000) /lib64/ld-linux-x86-64.so.2 (0x000000552aaaa000) I assume other stuff that uses libreadline (e.g. bash) works fine on your system, then? If so, then I'm not really sure what is going wrong here. Might be worthwhile to try adding "-g" to CFLAGS when emerging atftp, to enable debugging symbols in the binary. Then run the result through gdb, and see if the backtrace reveals the source line in atftp that is triggering the crash for you.
I've tracked this down a bit, and here's what I get. This is the backtrace for a normal build: Program received signal SIGSEGV, Segmentation fault. 0x0000002a95814690 in strlen () from /lib/tls/libc.so.6 (gdb) bt #0 0x0000002a95814690 in strlen () from /lib/tls/libc.so.6 #1 0x0000002a95693b6c in add_history () from /lib/libreadline.so.5 #2 0x00000000004022c1 in read_cmd () at tftp.c:263 #3 0x0000002a957c2798 in __libc_start_main () from /lib/tls/libc.so.6 #4 0x0000000000401eea in _start () (gdb) up #1 0x0000002a95693b6c in add_history () from /lib/libreadline.so.5 (gdb) up #2 0x00000000004022c1 in read_cmd () at tftp.c:263 263 add_history(string); (gdb) p string $1 = 0x0 (gdb) p &string Address requested for identifier "string" which is in register $rbx Note that string is a register. The problem appears to be that, after the call to make_arg(), string is NULL, which causes the add_histor() call to eventually fail. I rebuilt without optimizations, and I get a different core: Program received signal SIGSEGV, Segmentation fault. 0x00000000004026d1 in make_arg (string=0x51d640 "dir", argc=0x7fbffff56c, argv=0x7f00000000) at tftp.c:368 368 if ((*argv = realloc(*argv, (*argc + 1) * sizeof(char *))) == NULL) (gdb) bt #0 0x00000000004026d1 in make_arg (string=0x51d640 "dir", argc=0x7fbffff56c, argv=0x7f00000000) at tftp.c:368 #1 0x0000000000402460 in read_cmd () at tftp.c:259 #2 0x000000000040234c in main (argc=1, argv=0x7fbffff688) at tftp.c:186 (gdb) p *argv Cannot access memory at address 0x7f00000000 (gdb) p argv $1 = (char ***) 0x7f00000000 (gdb)
OK, I can now confirm the segfault when I relink this against glibc-2.3.4.20050125. My gdb dumps almost exactly match yours. The odd thing is that merely updating my system to glibc-2.3.4.20050125 did not cause the previous build of atftp (which was linked against glibc-2.3.3.20041102) to crash. I suspect something in the glibc-2.3.4.20050125 headers has changed, which is causing this. Perhaps the glibc maintainers might want to have a look at this, and provide additional clues as to what is going on?
Clarification: I meant to say "recompile" above. Merely relinking atftp against glibc-2.3.4.20050125 probably would not have any effect. Recompiling against the newer glibc header files, though, is probably another story.
in CVS now, thanks