On Sun, Jan 27, 2008 at 11:26:40AM +0100, Robert Luberda wrote: > tags 341701 patch > thanks > > Bill Allombert writes: > > > Hi, > > > >Thanks a lot, it seems fine. > >By any chance do you have an idea how to fix bug #341701 ? > > > The problem is the standard shell returns exit status of the last > command as the status of pipe. You can obey this either by avoiding the > pipe (i.e. running only dpkg-query and do filtering directly in > update-menus) or by using non-POSIX `pipefail' option (so you need to > make sure shell supports it). > > A simple patch for the second solution: > > In read_packages() just after initialization of pkgs variable add the > following line: > > pkgs = "exec /bin/bash -o pipefail -c \"" + pkgs + "\""; > > > Of course you need to check return value of pclose() call, e.g.: > > if (pclose(status)) { > > exit (1); > }
Well, I applied the following patch (w.r.t the CVS version) and this breaks menu auto-update feature. This is very strange. Cheers, -- Bill. <[EMAIL PROTECTED]> Imagine a large red swirl here.
Index: update-menus/update-menus.cc =================================================================== RCS file: /cvsroot/menu/menu/update-menus/update-menus.cc,v retrieving revision 1.59 diff -u -r1.59 update-menus.cc --- update-menus/update-menus.cc 27 Feb 2008 13:31:03 -0000 1.59 +++ update-menus/update-menus.cc 3 Mar 2008 19:37:04 -0000 @@ -436,7 +436,8 @@ { // Here we get the list of *installed* packages from dpkg, using sed to // retrieve the package name. - string pkgs = "dpkg-query --show --showformat='${status} ${provides} ${package}\\n' | sed -n -e '/installed /{s/^.*installed *//; s/[, ][, ]*/\\n/g; p}'"; + string pkgs = "dpkg-query --show --showformat=\"\\${status} \\${provides} \\${package}\\n\" | sed -n -e \"/installed /{s/^.*installed *//; s/[, ][, ]*/\\n/g; p}\""; + pkgs = "exec /bin/bash -o pipefail -c '" + pkgs + "'"; FILE *status = popen(pkgs.c_str(), "r"); if (!status) @@ -455,7 +456,8 @@ installed_packages.insert(tmp); } } - pclose(status); + if (pclose(status)) + throw pipeerror_read(pkgs.c_str()); } /** Read a menufile and create one (or more) menu entries for it.