Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

archive.sh readlink -f illegal operation under FreeBSD7.1 #1033

Closed
anonymous-matomo-user opened this issue Nov 2, 2009 · 10 comments
Closed
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@anonymous-matomo-user
Copy link

in misc/cron/archive.sh line 26:

PIWIK_CRON_FOLDER=dirname $(readlink -f ${0})

Gives an error:
readlink: illegal option -- f
usage: readlink [file ...
usage: dirname string

Testing readlink on Scientific Linux SL release 5.3

readlink -f /path/to/file

also gives an error

readlink: Need exactly one argument.
Try `readlink --help' for more information.

@robocoder
Copy link
Contributor

Remove the -f and report back to us.

@anonymous-matomo-user
Copy link
Author

man readlink says:
'When invoked as readlink, only the target of the symbolic link is
printed. If the given argument is not a symbolic link, readlink will
print nothing and exit with an error.'

I've changed it to
PIWIK_CRON_FOLDER=dirname ${0}

To make my local version work

@robocoder
Copy link
Contributor

Ah yes, thanks for the reminder. That's why we use -f.

@anonymous-matomo-user
Copy link
Author


act_path() {
    local pathname="$1"
    readlink -f "$pathname" 2>/dev/null || \
    realpath "$pathname" 2>/dev/null || \
    type -P "$pathname" 2>/dev/null
}

ARCHIVE=`act_path ${0}`
PIWIK_CRON_FOLDER=`dirname ${ARCHIVE}`

The above works for me on FreeBSD and Scientific Linux SL

@mattab
Copy link
Member

mattab commented Nov 2, 2009

ogs22, do you think you could submit a version that works on freebsd-SL linux and on debian/other linux? it would be very useful. Thanks

@anonymous-matomo-user
Copy link
Author

Sorry yes I should have said the above code should work on any Linux version the original code worked on as it tries the readlink -f first.

I'll attach the modified archive.sh

@anonymous-matomo-user
Copy link
Author

Attachment:
archive.sh

@mattab
Copy link
Member

mattab commented Nov 2, 2009

ogs22, could you post a diff instead of the full file please? thx

@anonymous-matomo-user
Copy link
Author

Attachment:
archive.patch

@robocoder
Copy link
Contributor

In [1568], fixes #1033 - archive.sh patch; thanks ogs22

@anonymous-matomo-user anonymous-matomo-user added this to the Piwik 0.5 milestone Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

3 participants