![]() |
ProblemWhen trying the ipkg update && ipkg upgrade the ipkg segfaults. Symptoms$ipkg -V 3 install wget-ssl
pkg_info_preinstall_check: updating arch priority for each package
pkg_info_preinstall_check: update file owner list
best installation candidate for wget-ssl
adding wget-ssl to providers
wget-ssl arch=powerpc arch_priority=10 constraint=1
using latest matching wget-ssl 1.10.2-3 powerpc
arch powerpc (priority 10) supported for pkg wget-ssl
Installing wget-ssl (1.10.2-3) to root...
Downloading
http://ipkg.nslu2-linux.org/feeds/optware/ds101g/cross/stable/wget-ssl_1.10.2-3_powerpc.ipk
best installation candidate for openssl
adding openssl to providers
openssl arch=powerpc arch_priority=10 constraint=1
using latest version of installed package openssl
pkg_depends.c:177: satisfying_pkg=0x100a09f0
Running script /tmp/ipkg-bsEuV6/wget-ssl-aTTdFp/preinst
Replacing pre-existing file /opt/man/man1/wget.1 owned by package wget-ssl
Replacing pre-existing file /opt/bin/wget owned by package wget-ssl
installing maintainer scripts
installing data files
extracting data files to /
Calling pkg_write_filelist from install_data_files
creating wget-ssl.list file
creating //opt/lib/ipkg/info/wget-ssl.list file for pkg wget-ssl
resolving conf files
Segmentation fault (core dumped)
or # ipkg info ipkg Package: ipkg Version: 0.99-163-2 Status: unknown ok not-installed Section: base Architecture: powerpc maintainer: NSLU2 Linux <nslu2-linux@yahoogroups.com> MD5Sum: cda27fe3b5c24d74e1ba8690f69c3617 Size: 81862 Filename: ipkg_0.99-163-2_powerpc.ipk Source: :pserver:anoncvs@anoncvs.handhelds.org Description: The Itsy Package Manager Successfully terminated. # ipkg install ipkg Installing ipkg (0.99-163-2) to root... Downloading >http://ipkg.nslu2-linux.org/feeds/optware/ds101g/cross/stable/ipkg_0.99-163-2_powerpc.ipk Segmentation fault (core dumped) WorkaroundTo overcome this you need to download and manually install the new ipkg. Do this by the following the steps below:
This is a log of the successful ipkg update: # ipkg download ipkg
Downloading http://ipkg.nslu2-linux.org/feeds/optware/ds101g/cross/stable/ipkg_0.99-163-2_powerpc.ipk
Downloaded ipkg as ./ipkg_0.99-163-2_powerpc.ipk
Successfully terminated.
# tar xzf ipkg_0.99-163-2_powerpc.ipk
# tar xzf data.tar.gz
# cp ./opt/bin/ipkg /opt/bin
# cp ./opt/lib/libipkg.so.0.0.0 /opt/lib
# ipkg install ipkg
Installing ipkg (0.99-163-2) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/ds101g/cross/stable/ipkg_0.99-163-2_powerpc.ipk
Configuration file '/opt/etc/ipkg.conf'
==> File on system created by you or by a script.
==> File also in package provided by package maintainer.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions (if diff is installed)
The default action is to keep your current version.
*** ipkg.conf (Y/I/N/O/D) [default=N] ? Y
Configuring ipkg
Successfully terminated.
# ipkg update
Downloading http://ipkg.nslu2-linux.org/feeds/optware/ds101g/cross/stable/Packages.gz
Inflating http://ipkg.nslu2-linux.org/feeds/optware/ds101g/cross/stable/Packages.gz
Updated list of available packages in /opt/var/lib/ipkg/cross
Successfully terminated.
# ipkg upgrade
Upgrading openssl on root from 0.9.7d-4 to 0.9.7d-5...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/ds101g/cross/stable/openssl_0.9.7d-5_powerpc.ipk
Upgrading wget-ssl on root from 1.10-1 to 1.10.2-3...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/ds101g/cross/stable/wget-ssl_1.10.2-3_powerpc.ipk
Configuration file '/opt/etc/wgetrc'
==> File on system created by you or by a script.
==> File also in package provided by package maintainer.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions (if diff is installed)
The default action is to keep your current version.
*** wgetrc (Y/I/N/O/D) [default=N] ? Y
Configuring openssl
Configuring wget-ssl
Successfully terminated.
SolutionThe problem was solved here are the crucial emails from the mailin list. Now the workaround shouldn't be needed. The solution was supplied by mcdmx at users.sourceforge.net Gerald Dachs wrote:
> What makes me nervous only that I didn't fix the problem, I made only a workaround, because
> I couldn't find a bug that produces the segfault. I know exactly the place where it segfaults, but
> I don't find a reason why.
The bug is triggered whenever ipkg tries to update a localy-modified config
file. ipkg then prompts the user if the file should be updated or not. ipkg's
user.c misses a matching va_end() call and this may lead to a segmentation fault.
Excerpt from the va_end() manpage:
"Each invocation of va_start must be matched by a corresponding invocation of
va_end in the same function. After the call va_end(ap) the variable ap is
undefined. Multiple transversals of the list, each bracketed by va_start and
va_end are possible."
The proper fix (IMO) looks like this:
--- user.c 2004-02-25 14:18:01.000000000 +0100
+++ user.c.patched 2005-10-26 18:04:48.000000000 +0200
@@ -34,7 +34,6 @@
int len = question_len;
va_list ap;
char *response;
- va_start(ap, format);
#ifndef IPKG_LIB
vprintf(format, ap);
@@ -47,7 +46,9 @@
question = realloc(question, len + 1);
question_len = len;
}
+ va_start(ap, format);
len = vsnprintf(question,question_len,format,ap);
+ va_end(ap);
} while (len > question_len);
response = strdup(ipkg_cb_response(question));
#endif
Cheers,
Michel
===================
On Thu, 14 Sep 2006 09:26:27 +0200
mcdmx at users.sourceforge.net wrote:
> Gerald Dachs wrote:
> > What makes me nervous only that I didn't fix the problem, I made only a workaround, because
> > I couldn't find a bug that produces the segfault. I know exactly the place where it segfaults, but
> > I don't find a reason why.
>
> The bug is triggered whenever ipkg tries to update a localy-modified config
> file. ipkg then prompts the user if the file should be updated or not.
This I knew already.
> ipkg's
> user.c misses a matching va_end() call and this may lead to a segmentation fault.
>
You are absolutely right, and I guess it is pure luck that this doesn't happen on the
other platforms. I expect that most of the time the buffer for the message is big enough,
so that there is no need for the realloc and another call of the vsnprintf func.
That makes me even sure that my workaround don't hide a big problem, but I
will try to make the real fix today.
do you wan't to mail the ipkg developer?
Gerald
=====================
Gerald Dachs wrote:
> do you wan't to mail the ipkg developer?
Yup, I've just sent the patch to the familiar mailing-list...
Bad flash also causes this problemPay particular attention that the segmentation fault error will also occur when the unsling is performed (by error) over the flash, filling it. You will have to recover from a bad flash (see RecoverFromABadFlash ) before you can continue. |