Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 56206 - prepstrip - find command regular expression not working correctly
Summary: prepstrip - find command regular expression not working correctly
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2004-07-06 00:42 UTC by Daniel Hurt
Modified: 2004-10-22 08:47 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Hurt 2004-07-06 00:42:10 UTC
The problem I believe is with this command in /usr/lib/portage/bin/prepstrip:

find "${x}" -type f \( -perm +0111 -or -regex '\.so$|\.so\.' \) -print0 | $XARGS -0 -n500 prepstrip

The -regex is not performing as intended. Since it is not performing as expected (I believe), I am not sure what the desired output is.  But from looking at the command, I think it is trying to find all files that:

1) Have +x ugo 
-OR-
2) Match *.so(EOL)    (EOL=End of Line)
-OR-
3) Match *.so.*

The second and third checks are not working. 



Reproducible: Always
Steps to Reproduce:
To See the problem run the following command:
1. find /usr -type f -regex '\.so$|\.so\.' -print 
Actual Results:  
# find /usr/ -type f -regex '\.so$|\.so\.'

#

Expected Results:  
The results should match this command:

# find /usr/ -type f | grep -E '\.so$|\.so\.'
/usr/lib/ao/plugins-2/liboss.so
/usr/lib/ao/plugins-2/libalsa09.so
/usr/lib/librecode.so.0.0.0
/usr/lib/libOggFLAC++.so.0.0.4
/usr/lib/gimp/1.2/modules/libcolorsel_gtk.so
/usr/lib/gimp/1.2/modules/libcolorsel_triangle.so
/usr/lib/gimp/1.2/modules/libcolorsel_water.so
....

I believe it should have found the files in /usr that are named *.so and *.so.*.
The reason that this has not been noticed is that most of the .so files are
marked exectutable and so are caught by the first check.

[~] > emerge --info
Portage 2.0.50-r8 (default-x86-2004.0, gcc-3.4.1, glibc-2.3.4.20040605-r1,
2.6.7-gentoo-r6)
=================================================================
System uname: 2.6.7-gentoo-r6 i686 Intel(R) Celeron(TM) CPU                1066MHz
Gentoo Base System version 1.5.1
distcc 2.14 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled]
ccache version 2.3 [enabled]
Autoconf: sys-devel/autoconf-2.59-r4
Automake: sys-devel/automake-1.8.5-r1
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-O2 -march=pentium3 -mtune=pentium3 -ffast-math -ftracer
-frename-registers -fomit-frame-pointer -momit-leaf-frame-pointer -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config
/usr/kde/3/share/config /usr/lib/GNUstep/Apps/Login.app /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="-O2 -march=pentium3 -mtune=pentium3 -ffast-math -ftracer
-frename-registers -fomit-frame-pointer -momit-leaf-frame-pointer -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs buildpkg ccache distcc sandbox"
GENTOO_MIRRORS=" http://gentoo.mirrors.pair.com/
http://cudlug.cudenver.edu/gentoo/ http://mirrors.tds.net/gentoo/
ftp://mirrors.tds.net/gentoo http://gentoo.mirrors.pair.com/
ftp://gentoo.mirrors.pair.com/"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage /usr/local/bmg-main"
SYNC="rsync://xenophobia/gentoo-portage"
USE="X acpi alsa avi berkdb crypt cscope cups encode fbcon foomaticdb gdbm gif
gpm gtk gtk2 imlib java jpeg libg++ libwww mad mikmod mmx motif mozilla mpeg
ncurses nls nptl offensive oggvorbis opengl oss pam pcmcia pdflib perl plotutils
png ppds python qt quicktime readline sdl slang spell sse ssl svga tcpd tetex
truetype usb x86 xml2 xmms xv xvid zlib"
Comment 1 Daniel Hurt 2004-07-06 00:47:01 UTC
Possible Fixes Depending on the behavior desired:

find "${x}" -type f \( -perm +0111 -or -name *.so \) -print0
find "${x}" -type f \( -perm +0111 -or -name *.so -or -name *.so.* \) -print0

or from ferringb in IRC:
find "${x}" -type f \( -perm +0111 -regex '.+\.so$' -or -regex '.+\.so\..+' \)
Comment 2 Daniel Hurt 2004-07-08 08:01:14 UTC
For *BSD compatibility, speicifically openBSD compatibility, the find command should omit references to the regex flag and also change the -perm flags syntax.  OpenBSD does not support the "+" attribute for permissions.  Depending on the desired behavior, the new command could be either:

1) find "${x}" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 -or -name *.so \)
2) find "${x}" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 -or -name *.so -or -name *.so.* \)

The replacement of the -perm +0111 with these "or"ed perm statments finds the same files and is a drop in replacement for the current command.  Until the regex behavior is fixed, I can only assume that the -name flags provide the desired behavior.
Comment 3 Nicholas Jones (RETIRED) gentoo-dev 2004-07-08 14:59:39 UTC
Comment #2's #2 is included in CVS now.
Comment 4 Nicholas Jones (RETIRED) gentoo-dev 2004-10-22 08:47:32 UTC
Bug has been fixed and released in stable portages on or before 2.0.51-r2