Opened 11 years ago

Closed 11 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 Changed 11 years ago by korli

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

comment:2 Changed 11 years ago by andreasf

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.

comment:3 in reply to:  1 Changed 11 years ago by andreasf

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 Changed 11 years ago by korli

Resolution: fixed
Status: newclosed

Applied patch from kaliber in hrev24131. Tested OK.

Note: See TracTickets for help on using tickets.