Opened 17 years ago
Closed 15 years ago
#13918 closed defect (fixed)
port activate returns 0 exit code even when unsuccessful
Reported by: | ryandesign (Ryan Carsten Schmidt) | Owned by: | macports-tickets@… |
---|---|---|---|
Priority: | Normal | Milestone: | MacPorts 1.8.0 |
Component: | base | Version: | 1.7.0 |
Keywords: | Cc: | bulk@…, vinc17@…, blb@…, febeling@…, jmroot (Joshua Root) | |
Port: |
Description
The p5-pathtools port, for example, requires that you activate it with the -f
flag to force it to overwrite files installed by the perl5.8 port. If you do not do this, you get an error message and the p5-pathtools port does not activate. However, unexpectedly, the exit code of the port
command is still 0. The exit code should be nonzero, since the command did not successfully complete.
$ sudo port activate p5-pathtools @3.25_0 ---> Activating p5-pathtools 3.25_0 Error: port activate failed: Image error: /opt/local/lib/perl5/5.8.8/darwin-2level/auto/Cwd/Cwd.bs is being used by the active perl5.8 port. Please deactivate this port first, or use the -f flag to force the activation. $ echo $? 0 $
Change History (10)
comment:1 Changed 17 years ago by ryandesign (Ryan Carsten Schmidt)
Component: | ports → base |
---|---|
Milestone: | Port Bugs → MacPorts base bugs |
comment:2 Changed 17 years ago by jmroot (Joshua Root)
comment:3 Changed 17 years ago by raimue (Rainer Müller)
Thing is, you can specify multiple ports. port install foo bar
will still install bar even if installing foo failed. So currently here it always exits with zero.
But if you specify -x, it will halt after foo if it failed and bar will not be installed, port returns non-zero.
What should we do?
comment:4 Changed 16 years ago by tobypeterson
Milestone: | MacPorts base bugs → MacPorts Future |
---|
Milestone MacPorts base bugs deleted
comment:5 Changed 16 years ago by blb@…
Cc: | bulk@… vinc17@… blb@… added |
---|
Cc those from dup #14928 (and me).
comment:6 follow-up: 7 Changed 16 years ago by blb@…
Milestone: | MacPorts Future → MacPorts 1.8.0 |
---|
We have both -x and -p, which basically do opposite things, and is therefore really confusing. I say what -x does should be the default for port (stop when an error happens) and keep -p for those (few?) who really want port to continue even when it encounters an error.
comment:7 Changed 16 years ago by ryandesign (Ryan Carsten Schmidt)
Replying to blb@…:
We have both -x and -p, which basically do opposite things, and is therefore really confusing. I say what -x does should be the default for port (stop when an error happens) and keep -p for those (few?) who really want port to continue even when it encounters an error.
Sounds good. I have gotten in the habit of manually typing the "-x" option every time I install or upgrade a port.
I do use the "-p" option on occasion as well. Sometimes I want to "port clean all" to clean out partial build attempts. Sometimes one of the partial build attempts will have been done as root. (My install is non-root so most software is not built as root.) Those that were built as root will interrupt "port clean all" unless I use "-p":
$ port clean osx2x mysql5 portaudio ImageMagick ---> Cleaning osx2x /mp/var/macports/build/_Users_rschmidt_macports_dports_databases_mysql5/work/.macports.mysql5.state is not writable - check permission on port directory Error: Status 1 encountered during processing. $ port -p clean osx2x mysql5 portaudio ImageMagick ---> Cleaning osx2x /mp/var/macports/build/_Users_rschmidt_macports_dports_databases_mysql5/work/.macports.mysql5.state is not writable - check permission on port directory Error: Status 1 encountered during processing. ---> Cleaning portaudio ---> Cleaning ImageMagick $
comment:8 Changed 16 years ago by blb@…
If port's default operation is to act like -x, I think the -999 stuff can also be removed. The only thing with that is in proc process_command_files
where port processes each file, then returns the exit status from the last one processed.
Instead, it should (in my opinion) return the status from the first non-zero and not continue, unless -p were given, then act like it does now.
comment:10 Changed 15 years ago by jmroot (Joshua Root)
Cc: | jmr@… added |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Fixed in r53704. The -999 stuff is still needed as it is how the quit/exit command works for interactive mode.
This actually seems to apply to all actions. The relevant code is here.
process_cmd
always returns 0 regardless of the action's return status, unless you've used the -x option. There is however a magic -999 status code that makes it break immediately.