Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#59880 closed defect (fixed)

grep: links with libsigsegv

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: Schamschula (Marius Schamschula)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: grep

Description

grep links with libsigsegv though it doesn't declare a dependency on it.

$ otool -L /opt/local/bin/ggrep
/opt/local/bin/ggrep:
	/opt/local/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.5.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1454.90.0)
	/opt/local/lib/libiconv.2.dylib (compatibility version 9.0.0, current version 9.0.0)
	/opt/local/lib/libpcre.1.dylib (compatibility version 4.0.0, current version 4.10.0)
	/opt/local/lib/libsigsegv.2.dylib (compatibility version 3.0.0, current version 3.5.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)

Change History (8)

comment:1 Changed 5 years ago by Schamschula (Marius Schamschula)

Apparently, opportunistic linking. On my machine

$ otool -L /opt/local/bin/ggrep
/opt/local/bin/ggrep:
	/opt/local/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.5.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1670.10.0)
	/opt/local/lib/libiconv.2.dylib (compatibility version 9.0.0, current version 9.1.0)
	/opt/local/lib/libpcre.1.dylib (compatibility version 4.0.0, current version 4.11.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0)

I will add --without-libsigsegv to the configure arguments, and make a libsigsegv variant.

comment:2 Changed 5 years ago by Schamschula (Marius Schamschula)

Resolution: fixed
Status: assignedclosed

In 00eacf32c545c24c6747459f1c5e23d3af977231/macports-ports (master):

grep: don't opportunisticallty link to libsigsegv.

add libsigsegv variant
Closes: #59880

comment:3 Changed 5 years ago by ned-deily (Ned Deily)

Are you sure that the new default (no libsegsegv) variant works? I upgraded to grep @3.3_1 from source and when I tried to install the built archive on another system it reported a broken port for grep. Running

port -d rev-upgrade

showed that the problem was a missing libsigsegv on this machine and examining grep on the build machine (which does have the libsigsegv port installed), I see that grep was linked to it even though I did not specify the +libsigsegv variant.

# port info grep
grep @3.3_1 (sysutils)
Variants:             libsigsegv, universal

Description:          Grep searches one or more input files for lines containing a match to a specified pattern. By default, grep prints the matching lines.
Homepage:             https://www.gnu.org/software/grep/grep.html

Extract Dependencies: xz
Library Dependencies: pcre, gettext
Platforms:            darwin
License:              GPL-3+
Maintainers:          Email: mps@macports.org, GitHub: Schamschula
                      Policy: openmaintainer
# otool -L /opt/macports/bin/ggrep
/opt/macports/bin/ggrep:
	/opt/macports/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.5.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1673.126.0)
	/opt/macports/lib/libiconv.2.dylib (compatibility version 9.0.0, current version 9.1.0)
	/opt/macports/lib/libpcre.1.dylib (compatibility version 4.0.0, current version 4.11.0)
	/opt/macports/lib/libsigsegv.2.dylib (compatibility version 3.0.0, current version 3.5.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0)

Update: I tried reinstalling with an explicit -libsigsegv and it still linked to it:

# port uninstall grep
# port install grep -libsigsegv
--->  Computing dependencies for grep
--->  Fetching distfiles for grep
--->  Verifying checksums for grep
--->  Extracting grep
--->  Configuring grep
--->  Building grep
--->  Staging grep into destroot
--->  Installing grep @3.3_1
--->  Activating grep @3.3_1
--->  Cleaning grep
--->  Updating database of binaries
[...]
# otool -L /opt/macports/bin/ggrep
/opt/macports/bin/ggrep:
	/opt/macports/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.5.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1673.126.0)
	/opt/macports/lib/libiconv.2.dylib (compatibility version 9.0.0, current version 9.1.0)
	/opt/macports/lib/libpcre.1.dylib (compatibility version 4.0.0, current version 4.11.0)
	/opt/macports/lib/libsigsegv.2.dylib (compatibility version 3.0.0, current version 3.5.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0)
Last edited 5 years ago by ned-deily (Ned Deily) (previous) (diff)

comment:4 Changed 5 years ago by Schamschula (Marius Schamschula)

My Mojave machine was previously using grep w/o libsigsegv. I only installed libsigsegv to test build the new variant.

On my Catalina machine, which lacks libsigsegv:

$ otool -L /opt/local/bin/ggrep
/opt/local/bin/ggrep:
	/opt/local/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.5.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1673.126.0)
	/opt/local/lib/libiconv.2.dylib (compatibility version 9.0.0, current version 9.1.0)
	/opt/local/lib/libpcre.1.dylib (compatibility version 4.0.0, current version 4.11.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0)

However, all my machines build ports I maintain from source (in the local tree).

My workaround suggestion is to build it from source using the -s switch.

I will investigate this in the next few days.

comment:5 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: closedreopened

Confirmed:

configure: WARNING: unrecognized options: --without-libsigsegv

The option is actually called --without-libsigsegv-prefix, but amazingly, that doesn't work either. Since I'm already looking at it, I'll see if I can fix it...

comment:6 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: reopenedclosed

In a8967b17589a390252ce05957e2811fd21ad9772/macports-ports (master):

grep: Really prevent opportunistic use of libsigsegv

Closes: #59880

comment:7 Changed 4 years ago by Schamschula (Marius Schamschula)

In 00eacf32c545c24c6747459f1c5e23d3af977231/macports-ports (dar, master, py38-reproject, revert-6945-rust-1.43.0, wireshark):

grep: don't opportunisticallty link to libsigsegv.

add libsigsegv variant
Closes: #59880

comment:8 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

In a8967b17589a390252ce05957e2811fd21ad9772/macports-ports (dar, master, py38-reproject, revert-6945-rust-1.43.0, wireshark):

grep: Really prevent opportunistic use of libsigsegv

Closes: #59880

Note: See TracTickets for help on using tickets.