lftp crashes for me in various ways when using the "cls" command with
the -s (--size) switch on Mac OS X Intel x86.
Depending on how full the directory I'm listing is, it either crashes
on the first try or second/third.
The crash is always in ColumnOutput.cc, but the place and cause
varies, primarily depending on what other switches I used with cls. I
can use any other switch of cls, the crashes only occur if I have -
s/--size there among the options.
This happens if any kind of optimization used, I tried -O1 and -Os in
addition to the default -O2.
However, the problem disappears and lftp works flawlessly is
optimization is disabled (-O0).
It also works without problems with optimization enabled on Mac OS X
PowerPC, using the exact same system/compiler versions.
That it only happens on Mac OS X Intel, and only if optimizations are
enabled, leads me to believe this is more likely a gcc optimization
bug rather than a bug in lftp. I've decided to report it here anyway,
in case it helps somebody else.
Workaround: compile lftp with no optimizations, eg. CXXFLAGS=-O0 ./
configure && make
lftp -v:
LFTP | Version 3.5.11 | Copyright (c) 1996-2006 Alexander V. Lukyanov
Libraries used: Readline 4.3, OpenSSL 0.9.7l 28 Sep 2006, libiconv 1.9
gcc -v:
Target: i686-apple-darwin8
Thread model: posix
gcc version 4.0.1 (Apple Computer, Inc. build 5367)
Backtraces:
Trying cls -s:
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0xc532222c
0x0001635d in ColumnOutput::add (this=0xbffff810, name=0xbffff790 "
14486 ", color=0x9cc2c "") at ColumnOutput.cc:56
56 lst[lst_cnt-1]->append(name, color);
(gdb) bt
#0 0x0001635d in ColumnOutput::add (this=0xbffff810, name=0xbffff790
" 14486 ", color=0x9cc2c "") at ColumnOutput.cc:56
#1 0x00016fec in FileSetOutput::print (this=0x1322074,
[EMAIL PROTECTED], o=0x1321f00) at FileSetOutput.cc:126
#2 0x00017856 in clsJob::Do (this=0x1322020) at FileSetOutput.cc:388
#3 0x00029de4 in SMTask::Schedule () at SMTask.cc:241
#4 0x00007496 in Job::WaitDone (this=0x1300d30) at Job.cc:557
#5 0x00002c4f in main (argc=1, argv=0xbffff9c8) at lftp.cc:489
Trying my normally used cls --sort=date -s --filesize -h --date -1
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000004
0x00016447 in datum::print (this=0x13231c0, o=0x1321210, color=false,
skip=0, color_pref=0x1321550 "\033[", color_suf=0x1321580 "m",
color_reset=0x1323170 "\033[m") at ColumnOutput.cc:240
240 int len = strlen(names[i]);
(gdb) bt
#0 0x00016447 in datum::print (this=0x13231c0, o=0x1321210,
color=false, skip=0, color_pref=0x1321550 "\033[",
color_suf=0x1321580 "m", color_reset=0x1323170 "\033[m") at
ColumnOutput.cc:240
#1 0x00016729 in ColumnOutput::print (this=0xbffff810, o=0x1321210,
width=0, color=false) at ColumnOutput.cc:181
#2 0x0001718f in FileSetOutput::print (this=0x1321384,
[EMAIL PROTECTED], o=0x1321210) at FileSetOutput.cc:195
#3 0x00017856 in clsJob::Do (this=0x1321330) at FileSetOutput.cc:388
#4 0x00029de4 in SMTask::Schedule () at SMTask.cc:241
#5 0x00007496 in Job::WaitDone (this=0x1300d30) at Job.cc:557
#6 0x00002c4f in main (argc=1, argv=0xbffff9c8) at lftp.cc:489
Another with the same command:
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x8d000000
0x00015e38 in datum::~datum (this=0x7d6b) at ColumnOutput.cc:203
203 xfree(names[i]);
(gdb) bt
#0 0x00015e38 in datum::~datum (this=0x7d6b) at ColumnOutput.cc:203
#1 0x00015f02 in ColumnOutput::~ColumnOutput (this=0xbffff810) at
ColumnOutput.cc:50
#2 0x00017197 in FileSetOutput::print (this=0x1320664,
[EMAIL PROTECTED], o=0x1300e20) at FileSetOutput.cc:195
#3 0x00017856 in clsJob::Do (this=0x1320610) at FileSetOutput.cc:388
#4 0x00029de4 in SMTask::Schedule () at SMTask.cc:241
#5 0x00007496 in Job::WaitDone (this=0x1300d30) at Job.cc:557
#6 0x00002c4f in main (argc=1, argv=0xbffff9c8) at lftp.cc:489
Trying cls --sort=date -s --filesize -h --date
lftp(25504) malloc: *** Deallocation of a pointer not malloced:
0xfeedface; This could be a double free(), or free() called with the
middle of an allocated block; Try setting environment variable
MallocHelp to see tools to help debug
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x1ffe4000
0x00015e46 in datum::~datum (this=0x182b) at ColumnOutput.cc:204
204 xfree(colors[i]);
(gdb) bt
#0 0x00015e46 in datum::~datum (this=0x182b) at ColumnOutput.cc:204
#1 0x00015f02 in ColumnOutput::~ColumnOutput (this=0xbffff810) at
ColumnOutput.cc:50
#2 0x00017197 in FileSetOutput::print (this=0x13249c4,
[EMAIL PROTECTED], o=0x1321260) at FileSetOutput.cc:195
#3 0x00017856 in clsJob::Do (this=0x1324970) at FileSetOutput.cc:388
#4 0x00029de4 in SMTask::Schedule () at SMTask.cc:241
#5 0x00007496 in Job::WaitDone (this=0x1300d30) at Job.cc:557
#6 0x00002c4f in main (argc=1, argv=0xbffff9c8) at lftp.cc:489