Opened 12 years ago

Closed 12 years ago

#1773 closed bug (fixed)

$0 is set incorrectly

Reported by: andreasf Owned by: axeld
Priority: normal Milestone: R1
Component: System Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

$0 should contain the (relative) path to the executable, not the command used to call it.

The following test script:

#!/bin/sh
echo $0

called with test.sh prints ./test.sh on BeOS but test.sh on Haiku.

This seems to keep aclocal et al. from working, since $0 returns aclocal but the path to call itself is e.g. config/bin/aclocal.

Change History (4)

comment:1 by korli, 12 years ago

Just tried, and it correctly outputs ./test.sh on Haiku. Could you check ?

comment:2 by andreasf, 12 years ago

Not for me in hrev23933. I also tried the last revision before the runtime loader change (hrev23928) but same result. And I checked that Linux, too, does return the path.

in reply to:  1 comment:3 by andreasf, 12 years ago

Replying to korli:

Just tried, and it correctly outputs ./test.sh on Haiku.

Make sure you don't call it as ./test.sh, then obviously it outputs ./test.sh. ;)

comment:4 by korli, 12 years ago

Resolution: fixed
Status: newclosed

Applied patch from kaliber in hrev24131. Tested OK.

Note: See TracTickets for help on using tickets.