Opened 3 months ago

Last modified 3 months ago

#73103 new defect

activate fails when libarchive is installed but its bsdtar doesn't work

Reported by: rjones-sandia Owned by:
Priority: Normal Milestone: MacPorts Future
Component: base Version: 2.11.5
Keywords: Cc:
Port: libxml2

Description (last modified by ryandesign (Ryan Carsten Schmidt))

this command fails in the "install" process:

/usr/bin/bzip2 -d -c /opt/local/var/macports/software/libxml2/libxml2-2.13.8_0.darwin_23.arm64.tbz2 | ( bsdtar -xvp --hfsCompression -f - )

When I do this as root in / other apps linking to libxml2.dylib work but any "upgrade" breaks this manual fix.

I'm not sure why the bzip unpack fails. I would have thought it was a proxy issue but the tbz2 file has downloaded on the two machines.

I'm attaching the "main.log" for this install.

fyi I seem to be having similar problems with: nghttp2

Attachments (2)

libxml2.log (14.4 KB) - added by rjones-sandia 3 months ago.
log file for "port install libxml2"
tar.log (6.9 KB) - added by rjones-sandia 3 months ago.
tar unpack log with error

Download all attachments as: .zip

Change History (9)

Changed 3 months ago by rjones-sandia

Attachment: libxml2.log added

log file for "port install libxml2"

comment:1 Changed 3 months ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)

The log says:

:msg:activate --->  Activating libxml2 @2.13.8_0
:debug:activate Using bsdtar with HFS+ compression (if valid)
:debug:activate Using /usr/bin/bzip2
:debug:activate system: /usr/bin/bzip2 -d -c /opt/local/var/macports/software/libxml2/libxml2-2.13.8_0.darwin_23.arm64.tbz2 | ( bsdtar -xvp --hfsCompression -f - )
:info:activate dyld[98144]: Library not loaded: /opt/local/lib/libxml2.2.dylib
:info:activate   Referenced from: <1D67F583-965D-3185-B02F-519448DB54C9> /opt/local/bin/bsdtar
:info:activate   Reason: tried: '/opt/local/lib/libxml2.2.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/local/lib/libxml2.2.dylib' (no such file), '/opt/local/lib/libxml2.2.dylib' (no such file)
:info:activate bzip2: I/O or other error, bailing out.  Possible reason follows.
:info:activate bzip2: Broken pipe

It's trying to use MacPorts bsdtar (from the libarchive port) which can't run because it relies on libxml2 which is currently deactivated.

This should not happen. When using MacPorts bsdtar fails, MacPorts is supposed to be falling back to macOS bsdtar. I'm not sure why that fallback isn't happening.

The workaround would be:

sudo port -f deactivate libarchive
sudo port activate libxml2
sudo port activate libarchive
Last edited 3 months ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:2 in reply to:  1 Changed 3 months ago by jmroot (Joshua Root)

Replying to ryandesign:

It's trying to use MacPorts bsdtar (from the libarchive port) which can't run because it relies on libxml2 which is currently deactivated.

This should not happen. When using MacPorts bsdtar fails, MacPorts is supposed to be falling back to macOS bsdtar. I'm not sure why that fallback isn't happening.

It should avoid using bsdtar at all in that situation. https://github.com/macports/macports-base/blob/v2.11.5/src/registry2.0/portimage.tcl#L506

@rjones-sandia: What output do you get from the following command while seeing this issue?

/opt/local/bin/bsdtar -x --hfsCompression < /dev/null >& /dev/null ; echo $?

If I deactivate libxml2 on my system, I get:

zsh: abort      bsdtar -x --hfsCompression < /dev/null >&/dev/null
134
Last edited 3 months ago by jmroot (Joshua Root) (previous) (diff)

comment:3 Changed 3 months ago by ryandesign (Ryan Carsten Schmidt)

Component: portsbase
Milestone: MacPorts Future
Summary: activate libxml2 fails on Sonoma & Sequoiaactivate fails when libarchive is installed but its bsdtar doesn't work
Version: 2.11.5

I tried to reproduce this on macOS 12 and I'm surprised I can't. If I deactivate libxml2, libarchive's bsdtar still works, even though the libxml2 library it links with is no longer there. That should be impossible, unless I'm missing something due to insufficient caffeine. I'm on macOS 12 x86_64 and I also tried running sudo /usr/sbin/purge which made no difference.

comment:4 Changed 3 months ago by jmroot (Joshua Root)

In c391f3fe30142f2454ef1799de58b13481593c3d/macports-base (master):

prefer /usr/bin/tar for hfscompression

See: #73103

comment:5 Changed 3 months ago by rjones-sandia

Sorry for the delay, with my manual patch i.e. there is a libxml2.dylib in /opt/local/lib:

# /opt/local/bin/bsdtar -x --hfsCompression < /dev/null >& /dev/null ; echo $?
0

It seems the manual patch i.e.

/usr/bin/bzip2 -d -c /opt/local/var/macports/software/libxml2/libxml2-2.13.9_0.darwin_24.arm64.tbz2 | ( bsdtar -xvp --hfsCompression -f - )

has errors (see tar.log) but completes enough to put the lib in place

I did the activate toggle and it seems to work but I had to force the libxml2 activate since the were existing files

thanks,
R

Last edited 3 months ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

Changed 3 months ago by rjones-sandia

Attachment: tar.log added

tar unpack log with error

comment:6 Changed 3 months ago by rjones-sandia

ok looking at the top of the tar log it's just complaining I tried to unpack in / which is read only. I think it did all unpacking of files/libs fine

comment:7 in reply to:  3 Changed 3 months ago by jmroot (Joshua Root)

Replying to ryandesign:

I tried to reproduce this on macOS 12 and I'm surprised I can't. If I deactivate libxml2, libarchive's bsdtar still works, even though the libxml2 library it links with is no longer there. That should be impossible, unless I'm missing something due to insufficient caffeine

I see the same thing with macOS 12 arm64 in a VM. It works for the actual extraction, so I guess no problem? On macOS 14 like the reporter, I see the expected crash with the test command.

Note: See TracTickets for help on using tickets.