[MacPorts] #52211: bzip2 refuses to work, attempts to create /opt/local/bin/bzip2.bz2 file
#52211: bzip2 refuses to work, attempts to create /opt/local/bin/bzip2.bz2 file --------------------+-------------------------------- Reporter: uri@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Keywords: | Port: bzip2 --------------------+-------------------------------- When I try to bzip2 a file, I get this problem: {{{ $ pwd /Users/uri/src/ast61 $ ll Astro.txt -r--r--r-- 1 uri staff 4620 Sep 11 11:42 Astro.txt $ bzip2 Astro.txt bzip2: Can't create output file /opt/local/bin/bzip2.bz2: Permission denied. $ ll Astro.txt* -r--r--r-- 1 uri staff 2219 Sep 11 11:42 Astro.txt.bz2 $ bunzip2 Astro.txt.bz2 bunzip2: Can't guess original name for /opt/local/bin/bzip2 -- using /opt/local/bin/bzip2.out bunzip2: Output file /opt/local/bin/bzip2.out already exists. $ ll Astro.txt* -r--r--r-- 1 uri staff 4620 Sep 11 11:42 Astro.txt $ }}} While bzip2 does (usually - when not invoked from the script) create compressed file despite that complaint, it does not work when, e.g., bzip2 is invoked by GnuTAR: {{{ $ gnutar -cjvf t.tbz Astro.txt Astro.txt bzip2: Can't create output file /opt/local/bin/bzip2.bz2: Permission denied. gnutar: Child returned status 1 gnutar: Error is not recoverable: exiting now $ ll t.tbz -rw-r--r-- 1 uri staff 0 Sep 11 14:56 t.tbz $ }}} This bug (that I suspect is present in the upstream) prevents use of bzip2 - I'd appreciate your help. -- Ticket URL: <https://trac.macports.org/ticket/52211> MacPorts <https://www.macports.org/> Ports system for macOS
#52211: bzip2 refuses to work, attempts to create /opt/local/bin/bzip2.bz2 file ---------------------+-------------------------- Reporter: uri@… | Owner: ryandesign@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Resolution: | Keywords: Port: bzip2 | ---------------------+-------------------------- Changes (by ryandesign@…): * cc: ryandesign@… (removed) * owner: macports-tickets@… => ryandesign@… Comment: I've never seen anything like that before. It works fine for me: {{{ $ echo hello > Astro.txt $ ls -l Astro.txt* -rw-r--r-- 1 rschmidt wheel 6 Sep 11 16:48 Astro.txt $ bzip2 Astro.txt $ ls -l Astro.txt* -rw-r--r-- 1 rschmidt wheel 42 Sep 11 16:48 Astro.txt.bz2 $ bunzip2 Astro.txt.bz2 $ ls -l Astro.txt* -rw-r--r-- 1 rschmidt wheel 6 Sep 11 16:48 Astro.txt $ }}} Sounds like a misconfiguration of some sort on your system. Maybe an alias or function overriding MacPorts bzip2. What do you get when you run: {{{ type bzip2 type bunzip2 bzip2 --version bunzip2 --version }}} -- Ticket URL: <https://trac.macports.org/ticket/52211#comment:1> MacPorts <https://www.macports.org/> Ports system for macOS
#52211: bzip2 refuses to work, attempts to create /opt/local/bin/bzip2.bz2 file ---------------------+-------------------------- Reporter: uri@… | Owner: ryandesign@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Resolution: | Keywords: Port: bzip2 | ---------------------+-------------------------- Comment (by uri@…):
Sounds like a misconfiguration of some sort on your system.
Based on what I'm observing, I rather doubt that - but would be happy to hear suggestions how to find this out.
Maybe an alias or function overriding MacPorts bzip2
I don't think so - see below.
What do you get when you run...
This: {{{ $ type bzip2 bzip2 is hashed (/opt/local/bin/bzip2) $ type bunzip2 bunzip2 is hashed (/opt/local/bin/bunzip2) $ bzip2 --version bzip2, a block-sorting file compressor. Version 1.0.6, 6-Sept-2010. Copyright (C) 1996-2010 by Julian Seward. This program is free software; you can redistribute it and/or modify it under the terms set out in the LICENSE file, which is included in the bzip2-1.0.6 source distribution. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE file for more details. bzip2: Can't create output file /opt/local/bin/bzip2.bz2: Permission denied. $ bunzip2 --version bzip2, a block-sorting file compressor. Version 1.0.6, 6-Sept-2010. Copyright (C) 1996-2010 by Julian Seward. This program is free software; you can redistribute it and/or modify it under the terms set out in the LICENSE file, which is included in the bzip2-1.0.6 source distribution. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE file for more details. bunzip2: Can't guess original name for /opt/local/bin/bzip2 -- using /opt/local/bin/bzip2.out bunzip2: Can't create output file /opt/local/bin/bzip2.out: Permission denied. $ alias bzip2 -bash: alias: bzip2: not found $ alias bunzip2 -bash: alias: bunzip2: not found $ }}} -- Ticket URL: <https://trac.macports.org/ticket/52211#comment:2> MacPorts <https://www.macports.org/> Ports system for macOS
#52211: bzip2 refuses to work, attempts to create /opt/local/bin/bzip2.bz2 file ---------------------+-------------------------- Reporter: uri@… | Owner: ryandesign@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Resolution: | Keywords: Port: bzip2 | ---------------------+-------------------------- Comment (by ryandesign@…): I've found a reference to a similar problem: https://lists.macosforge.org/pipermail/macports- changes/2014-April/103619.html It suggests that you have set the `BZIP2` environment variable to the path to the bzip2 program. But the bzip2 program actually uses that variable for additional arguments. So you should unset the `BZIP2` environment variable. -- Ticket URL: <https://trac.macports.org/ticket/52211#comment:3> MacPorts <https://www.macports.org/> Ports system for macOS
#52211: bzip2 refuses to work, attempts to create /opt/local/bin/bzip2.bz2 file ---------------------+-------------------------- Reporter: uri@… | Owner: ryandesign@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Resolution: | Keywords: Port: bzip2 | ---------------------+-------------------------- Comment (by uri@…): Yes! I checked my .bashrc, and found {{{ export BZIP2=/opt/local/bin/bzip2 }}} in it (I don't remember what application needed that definition). Then, after unsetting it: {{{ $ unset BZIP2 $ bzip2 Astro.txt $ bunzip2 Astro.txt.bz2 $ }}} So when env variable BZIP2 is not set, it works just fine. But why would that env var screw things up so badly? Isn't that a bug? What do you think? -- Ticket URL: <https://trac.macports.org/ticket/52211#comment:4> MacPorts <https://www.macports.org/> Ports system for macOS
#52211: bzip2 refuses to work, attempts to create /opt/local/bin/bzip2.bz2 file ----------------------+-------------------------- Reporter: uri@… | Owner: ryandesign@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Resolution: invalid | Keywords: Port: bzip2 | ----------------------+-------------------------- Changes (by ryandesign@…): * status: new => closed * resolution: => invalid Comment: It's a documented feature of the bzip2 program. From its man page:
bzip2 will read arguments from the environment variables BZIP2 and BZIP, in that order, and will process them before any arguments read from the command line. This gives a convenient way to supply default arguments.
It was surprising to us too when we found out about this "feature" and we had to make some changes to MacPorts itself to not run into problems. We, too, had been using the `BZIP2` environment variable as a way to specify the path to the bzip2 program, and had to change it. -- Ticket URL: <https://trac.macports.org/ticket/52211#comment:5> MacPorts <https://www.macports.org/> Ports system for macOS
#52211: bzip2 refuses to work, attempts to create /opt/local/bin/bzip2.bz2 file ----------------------+-------------------------- Reporter: uri@… | Owner: ryandesign@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Resolution: invalid | Keywords: Port: bzip2 | ----------------------+-------------------------- Comment (by uri@…): I see, thanks! Appreciate your time and help! And I've unseated BZIP2 now. ;-) -- Ticket URL: <https://trac.macports.org/ticket/52211#comment:6> MacPorts <https://www.macports.org/> Ports system for macOS
participants (1)
-
MacPorts