Author: branden Date: 2004-02-20 12:17:19 -0500 (Fri, 20 Feb 2004) New Revision: 1085
Modified: trunk/debian/changelog trunk/debian/shell-lib.sh Log: (deregister_x_lib_dir_with_ld_so): Rework the file replacement logic so that we are indifferent to whether or not there are any lines in /etc/ld.so.conf that do not match /usr/X11R6/lib, and we do not replace the file if we're not actually changing it. Thanks to Filip Van Raemdonck and Andreas Metzler for forcing me to think about this more carefully. Modified: trunk/debian/changelog =================================================================== --- trunk/debian/changelog 2004-02-20 16:00:06 UTC (rev 1084) +++ trunk/debian/changelog 2004-02-20 17:17:19 UTC (rev 1085) @@ -27,8 +27,10 @@ * Fix missing second argument to fgrep in deregister_x_lib_dir_with_ld_so(), which can cause it to block, attempting to read from standard input; also drop -q from fgrep's option list, since we actually want to do something - with its output; finally, only attempt to remove /usr/X11R6/lib directory - from /etc/ld.so.conf if it is in the file (thanks, Filip Van Raemdonck). + with its output; finally, rework the file replacement logic so that we are + indifferent to whether or not there are any lines in /etc/ld.so.conf that + do not match /usr/X11R6/lib, and we do not replace the file if we're not + actually changing it (thanks, Filip Van Raemdonck and Andreas Metzler). (Closes: #233645) - debian/shell-lib.sh @@ -58,7 +60,7 @@ sunffb driver. - debian/patches/073_sunffb_xaa_render_fb_support.diff - -- Branden Robinson <[EMAIL PROTECTED]> Fri, 20 Feb 2004 10:58:40 -0500 + -- Branden Robinson <[EMAIL PROTECTED]> Fri, 20 Feb 2004 12:14:42 -0500 xfree86 (4.3.0-2) unstable; urgency=low Modified: trunk/debian/shell-lib.sh =================================================================== --- trunk/debian/shell-lib.sh 2004-02-20 16:00:06 UTC (rev 1084) +++ trunk/debian/shell-lib.sh 2004-02-20 17:17:19 UTC (rev 1085) @@ -557,7 +557,7 @@ # library in /usr/X11R6/lib, in the event "$1" is "remove", and before # invoking ldconfig. - local dir ldsoconf + local dir ldsoconf fgrep_status cmp_status dir="/usr/X11R6/lib" ldsoconf="/etc/ld.so.conf" @@ -568,10 +568,26 @@ if [ "$(echo "$dir"/lib*.so.*.*)" = "$dir/lib*.so.*.*" ]; then # glob expansion produced nothing, so no shared libraries are present observe "removing $dir directory from $ldsoconf" - if fgrep -qsx "$dir" "$ldsoconf"; then - fgrep -svx "$dir" "$ldsoconf" > "$ldsoconf.dpkg-tmp" - fi - mv "$ldsoconf.dpkg-tmp" "$ldsoconf" + # rewrite the file (very carefully) + set +e + fgrep -svx "$dir" "$ldsoconf" > "$ldsoconf.dpkg-tmp" + fgrep_status=$? + set -e + case $fgrep_status in + 0|1) ;; # we don't actually care if any lines matched or not + *) die "error reading \"$ldsoconf\"; fgrep exited with status" \ + "$fgrep_status" ;; + esac + set +e + cmp -s "$ldsoconf.dpkg-tmp" "$ldsoconf" + cmp_status=$? + set -e + case $cmp_status in + 0) rm "$ldsoconf.dpkg-tmp" ;; # files are identical + 1) mv "$ldsoconf.dpkg-tmp" "$ldsoconf" ;; # files differ + *) die "error comparing \"$ldsoconf.dpkg-tmp\" to \"$ldsoconf\"; cmp" \ + "exited with status $cmp_status" ;; + esac fi fi }