View Issue Details

IDProjectCategoryView StatusLast Update
0004700Dwarf FortressTechnical -- Generalpublic2011-06-14 12:51
Reporterfreezervv Assigned To 
PrioritylowSeveritytrivialReproducibilityalways
Status newResolutionopen 
PlatformLinuxOSUbuntuOS Version10.04
Product Version0.31.21 
Summary0004700: Init script handles symlinks poorly
DescriptionThe current method of getting the directory...
DF_DIR=$(dirname "$0")
... doesn't handle symlinks well, as they're hidden by the shell.

Suggest changing the line to a link-aware method, e.g. ...
DF_DIR=$(pwd -P)
... which appears to solve the problem more elegantly.
Steps To ReproduceCreate a symlink to the "df" script, e.g. ...
1) cd /usr/bin
2) ln -s {path to df}/df dwarffortress

... then try to run it.
3) dwarffortress
TagsNo tags attached.

Activities

freezervv

2011-06-14 12:51

reporter   ~0017993

Note: Above doesn't work, either. Solution should probably be closer to:

#!/bin/sh
if [ -h $0 ]
then
        DF_DIR=$(readlink -f "$0")
        DF_DIR=$(dirname "$DF_DIR")
else
        DF_DIR=$(dirname "$0")
fi
[...]

Add Note

Note

Issue History

Date Modified Username Field Change
2011-06-14 11:27 freezervv New Issue
2011-06-14 12:51 freezervv Note Added: 0017993