what is the operative readlink command?

Bug #999207 reported by jpvrlaone
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
coreutils (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

I stumlbed accross a problem where a script kept failing when running the readlink command.
It did not like the use of the -f flag which is supported in the man page. I got past the problem using /usr/lib/klibc/bin/readlink found through a search of the system. More details can be found in the forum using the tag "readlink".
What is going on with the readlink command?

Ubuntu 12.04 (precise)
2.6.38-8-generic
Intel(R) Core(TM) i5 CPU 650 @ 3.20GHz

Revision history for this message
Ralph Corderoy (ralph-inputplus) wrote :

It's not a good idea for us all to search through the forums and possibly read different material. Please state the problem here and give a direct link to the forum thread if you think it would be helpful background.

Changed in coreutils (Ubuntu):
status: New → Incomplete
Revision history for this message
C de-Avillez (hggdh2) wrote :

Thank you for opening this bug and helping make Ubuntu better.

Additionally, 'readlink' _is_ available on precise, and it does accept a '-f'. Please provide:

1. the command run, and the full output.
2. the output of 'readlink --version'

---
Ubuntu Bug Squad volunteer triager
http://wiki.ubuntu.com/BugSquad

Revision history for this message
jpvrlaone (jpv4433) wrote :

Reuested info follows plus error messages listed when ran as root and user.
Maybe

# readlink --version
readlink (GNU coreutils) 8.13
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Dmitry V. Levin.

MORE >>>
AS ROOT>
# readlink -f "$0"readlink: invalid option -- 'u'
Try `readlink --help' for more information.

AS USER >
$ readlink -f "$0"readlink: invalid option -- 'b'
Try `readlink --help' for more information.

BELOW IS
# ./install

DEFAULT_INSTALL_PATH="/opt/pcdir"
+ DEFAULT_INSTALL_PATH=/opt/pcdir
DEFAULT_RUN_USER="root"
+ DEFAULT_RUN_USER=root
DEFAULT_RUN_GROUP="root"
+ DEFAULT_RUN_GROUP=root
RUN_LEVELS=(2 3 4 5)
+ RUN_LEVELS=(2 3 4 5)
INSTALL_AS_SERVICE="y"
+ INSTALL_AS_SERVICE=y
SCRIPT=`readlink -f "$0"`
readlink -f "$0"
++ readlink -f ./install
+ SCRIPT=/opt/pcdir/install
INSTALLDIR=`dirname "$SCRIPT"`
dirname "$SCRIPT"
++ dirname /opt/pcdir/install
+ INSTALLDIR=/opt/pcdir

Revision history for this message
jpvrlaone (jpv4433) wrote : Re: [Bug 999207] Re: what is the operative readlink command?

Sorry but I don't understand what I am not being clear about other than I appear to not be  following the problem reporting protocol.

I probably stems from a misunderstanding of the readlink command's syntax as used in a script that was failing---readlink -f "$0".
When I tested it outside the script I got incorrect flag usage errors.

________________________________
 From: Ralph Corderoy <email address hidden>
To: <email address hidden>
Sent: Monday, May 14, 2012 11:30 AM
Subject: [Bug 999207] Re: what is the operative readlink command?

It's not a good idea for us all to search through the forums and
possibly read different material.  Please state the problem here and
give a direct link to the forum thread if you think it would be helpful
background.

** Changed in: coreutils (Ubuntu)
       Status: New => Incomplete

--
You received this bug notification because you are subscribed to the bug
report.
https://bugs.launchpad.net/bugs/999207

Title:
  what is the operative readlink command?

Status in “coreutils” package in Ubuntu:
  Incomplete

Bug description:
  I stumlbed accross a problem where a script  kept failing when running the readlink command.
  It did not like the use of the -f flag which is supported in the man page.  I got past the problem using  /usr/lib/klibc/bin/readlink  found through a search of the system.  More details can be found in the forum using the tag "readlink".
  What is going on with the readlink command?

  Ubuntu 12.04 (precise)
  2.6.38-8-generic
  Intel(R) Core(TM) i5 CPU        650  @ 3.20GHz

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/999207/+subscriptions

Revision history for this message
Ralph Corderoy (ralph-inputplus) wrote :

When running the ./install script it seems to me that readlink works correctly, do you agree?

Running readlink at the command line and passing it $0 might result in the errors you are seeing depending on the value of $0. Please try

    printf '<%s>\n' "$0"
    readlink -f -- "$0"

The pasting of your terminal session above is a bit corrupted; readlink's errors appear on the same line as your command. It helps us if we see precisely what you entered and saw in response. So for the above, I see

    $ printf '<%s>\n' "$0"
    </bin/bash>
    $ readlink -f -- "$0"
    /bin/bash
    $

Revision history for this message
Ralph Corderoy (ralph-inputplus) wrote :

Not a bug. Reporter has clarified in original Question that $0 at the command line was passing -bash to readlink(1).

Changed in coreutils (Ubuntu):
status: Incomplete → Invalid
Revision history for this message
jpvrlaone (jpv4433) wrote :

I agree that the expanded install script w(use of set -vx) worked with the readlink command.

But somehow things got fuzzy and I hate to reinstall the running software monitoring tool to reenact the crime since I hate for you and me to spend more time on this.

I made a closing entry in the bug about the $0 agrument.

THANKS FOR YOUR INTEREST

________________________________
 From: Ralph Corderoy <email address hidden>
To: <email address hidden>
Sent: Monday, May 14, 2012 5:53 PM
Subject: [Bug 999207] Re: what is the operative readlink command?

When running the ./install script it seems to me that readlink works
correctly, do you agree?

Running readlink at the command line and passing it $0 might result in
the errors you are seeing depending on the value of $0.  Please try

    printf '<%s>\n' "$0"
    readlink -f -- "$0"

The pasting of your terminal session above is a bit corrupted;
readlink's errors appear on the same line as your command.  It helps us
if we see precisely what you entered and saw in response.  So for the
above, I see

    $ printf '<%s>\n' "$0"
    </bin/bash>
    $ readlink -f -- "$0"
    /bin/bash
    $

--
You received this bug notification because you are subscribed to the bug
report.
https://bugs.launchpad.net/bugs/999207

Title:
  what is the operative readlink command?

Status in “coreutils” package in Ubuntu:
  Incomplete

Bug description:
  I stumlbed accross a problem where a script  kept failing when running the readlink command.
  It did not like the use of the -f flag which is supported in the man page.  I got past the problem using  /usr/lib/klibc/bin/readlink  found through a search of the system.  More details can be found in the forum using the tag "readlink".
  What is going on with the readlink command?

  Ubuntu 12.04 (precise)
  2.6.38-8-generic
  Intel(R) Core(TM) i5 CPU        650  @ 3.20GHz

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/999207/+subscriptions

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.