Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#28193 closed defect (fixed)

output to stderr should not make "port load" fail

Reported by: vinc17@… Owned by: macports-tickets@…
Priority: Normal Milestone: MacPorts 2.0.0
Component: base Version: 1.9.2
Keywords: tiger Cc:
Port:

Description

On Tiger, after installing smartmontools 5.40_3:

prunille:~> sudo port load smartmontools
Error: Target org.macports.load returned: Workaround Bonjour: Unknown error: 0
Log for smartmontools is at: /opt/local/var/macports/logs/_Users_vinc17_software_dports_sysutils_smartmontools/main.log
Error: Status 1 encountered during processing.

The log:

version:1
:debug:main Executing org.macports.main (smartmontools)
:debug:load load phase started at Sat Jan 29 01:01:37 CET 2011
:debug:load Executing org.macports.load (smartmontools)
:error:load Target org.macports.load returned: Workaround Bonjour: Unknown error: 0
:debug:load Backtrace: Workaround Bonjour: Unknown error: 0
    while executing
"exec $launchctl_path load -w $path"
    (procedure "portload::load_main" line 11)
    invoked from within
"$procedure $targetname"
:info:load Warning: the following items did not execute (for smartmontools): org.macports.load
:notice:load Log for smartmontools is at: /opt/local/var/macports/logs/_Users_vinc17_software_dports_sysutils_smartmontools/main.log

Change History (20)

comment:1 Changed 13 years ago by vinc17@…

"ps auxww" shows:

root     16607   0.0  0.1    27972   2212  ??  Ss    1:01AM   0:00.05 /opt/local/bin/daemondo --label=smartd --start-cmd /opt/local/sbin/smartd -p /opt/local/var/run/smartd.pid ; --pid=fileauto --pidfile /opt/local/var/run/smartd.pid
root     16610   0.0  0.0    28108    216  ??  S     1:01AM   0:00.00 /opt/local/sbin/smartd -p /opt/local/var/run/smartd.pid

So, smartd seems to be running anyway.

comment:2 Changed 13 years ago by tobypeterson

Resolution: wontfix
Status: newclosed

Probably some bug in launchctl, who knows. Tiger...

comment:3 Changed 13 years ago by vinc17@…

Resolution: wontfix
Status: closedreopened

I have no problem with "sudo launchctl load ...". So, the problem comes from MacPorts.

comment:4 Changed 13 years ago by tobypeterson

Resolution: wontfix
Status: reopenedclosed

It's still a Tiger bug. Does it repro on SL?

comment:5 Changed 13 years ago by vinc17@…

Resolution: wontfix
Status: closedreopened

It is not a Tiger bug. Or explain why it would be a bug. SL just behaves differently.

comment:6 Changed 13 years ago by jmroot (Joshua Root)

Keywords: tiger added

If it's not a bug, why is there a ticket?

Seriously, it's probably just Tcl interpreting writing to stderr as failure. Really not a big deal. By "Tiger bug", I assume Toby means "bug that only affects Tiger". In any case, there's nothing he can do about it in smartmontools. (Even if there was, he's still allowed to decide not to fix it…)

comment:7 in reply to:  6 ; Changed 13 years ago by vinc17@…

Replying to jmr@…:

If it's not a bug, why is there a ticket?

Because launchctl succeeds (I can check it by running it manually), while MacPorts assume that it failed.

Seriously, it's probably just Tcl interpreting writing to stderr as failure.

Wow! If it is does that, it is really broken. Warnings and non-fatal error messages can be written to stderr. Fatal errors can be checked by looking at the exit status of the command (some non-zero exit status of some commands can be non-fatal, as described by the documentation, but a zero status always means OK).

Really not a big deal. By "Tiger bug", I assume Toby means "bug that only affects Tiger". In any case, there's nothing he can do about it in smartmontools. (Even if there was, he's still allowed to decide not to fix it…)

The fix is easy: look at the exit status.

comment:8 in reply to:  7 ; Changed 13 years ago by danielluke (Daniel J. Luke)

Replying to vinc17@…:

The fix is easy: look at the exit status.

patch?

comment:9 in reply to:  8 ; Changed 13 years ago by vinc17@…

Component: portsbase

Replying to dluke@…:

patch?

I don't know very much about tcl, but first, the problem is actually in "base". portload.tcl has:

            exec $launchctl_path load -w $path

and man n exec says:

       -ignorestderr
                    Stops the exec command from treating the  output  of  mes- |
                    sages to the pipeline's standard error channel as an error |
                    case.

However this is a new option, and at least on Tiger, tcl doesn't have this option. Isn't it possible to require (or just allow) port to use the tcl version provided by MacPorts (after some bootstrap)?

/opt/local/bin/port has:

exec /usr/bin/tclsh "$0" "$@"

Is there any reason to use /usr/bin/tclsh instead of just tclsh?

FYI, about the stderr problem: http://www.tcl.tk/cgi-bin/tct/tip/267.html

comment:10 Changed 13 years ago by vinc17@…

Summary: smartmontools 5.40_3 cannot be loadedoutput to stderr should not make "port load" fail

comment:11 in reply to:  9 ; Changed 13 years ago by danielluke (Daniel J. Luke)

Replying to vinc17@…:

Replying to dluke@…:

patch?

I don't know very much about tcl,

well, you said the fix was easy :-)

Is there any reason to use /usr/bin/tclsh instead of just tclsh?

If you depend on the macports-provided tclsh, what happens when you try to upgrade it (hint - it's bad), or if you deactivate it (also bad)?

Of course, given that Apple isn't providing security updates for 10.4 any more - anyone running it should probably move to 10.5 any way.

comment:12 Changed 13 years ago by tobypeterson

Owner: changed from toby@… to macports-tickets@…
Status: reopenednew

comment:13 Changed 13 years ago by tobypeterson

Port: smartmontools removed

comment:14 Changed 13 years ago by jmroot (Joshua Root)

Have you tried to reproduce against trunk?

comment:15 in reply to:  11 Changed 13 years ago by vinc17@…

Replying to dluke@…:

Replying to vinc17@…:

Replying to dluke@…:

patch?

I don't know very much about tcl,

well, you said the fix was easy :-)

For someone who knows tcl (I know to do this kind of things in Perl or C).

Is there any reason to use /usr/bin/tclsh instead of just tclsh?

If you depend on the macports-provided tclsh, what happens when you try to upgrade it (hint - it's bad), or if you deactivate it (also bad)?

It could depend on the macports-provided tclsh for some features only. The version in /usr/bin/tclsh should be sufficient as a fallback.

Of course, given that Apple isn't providing security updates for 10.4 any more - anyone running it should probably move to 10.5 any way.

I won't upgrade to 10.5 because some of my hardware is incompatible with it. Then perhaps a solution would be to install a more recent tcl version in /usr/local. But that won't solve the problem if MacPorts hardcodes the path to /usr/bin/tclsh.

comment:16 in reply to:  14 Changed 13 years ago by vinc17@…

Replying to jmr@…:

Have you tried to reproduce against trunk?

No. Not sure how to do or if there's any risk of breaking things...

comment:17 Changed 13 years ago by jmroot (Joshua Root)

OK, so someone with access to Tiger needs to test with trunk, or we won't know whether the problem is already fixed, and if it isn't, whether any proposed fix works.

comment:18 Changed 13 years ago by vinc17@…

I've tried on trunk but I get another error:

$ sudo port load smartmontools
Error: Unable to execute port: couldn't open "/opt/local/var/macports/build/_Users_vinc17_software_dports_sysutils_smartmontools/work/.macports.smartmontools.state": permission denied

The file in question:

-rw-r--r-- 1 root admin 0 2011-01-29 01:01:37 /opt/local/var/macports/build/_Users_vinc17_software_dports_sysutils_smartmontools/work/.macports.smartmontools.state

I don't see how I can get a permission denied after a sudo (unless MacPorts changes the user).

comment:19 Changed 13 years ago by jmroot (Joshua Root)

Resolution: fixed
Status: newclosed

Assuming fixed by r75534...

comment:20 Changed 13 years ago by jmroot (Joshua Root)

Milestone: MacPorts 2.0.0
Note: See TracTickets for help on using tickets.