Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: ps2pdf script fail

  1. #1

    Default ps2pdf script fail

    New to tumbleweed, but not new to linux or opensuse. I upgraded to Tumbleweed last night from an older openSuse install. Had a few problems getting there, but worked through those. Now I'm cleaning up and fixing the things that changed or broke.

    One unexpected failure is that ps2pdf (/usr/bin/ps2pdf) no longer works. It's a pretty simple shell script, and I don't understand the failure here.

    Code:
    #!/bin/sh
    # Convert PostScript to PDF.
    
    # Currently, we produce PDF 1.4 by default, but this is not guaranteed
    # not to change in the future.
    version=14
    
    ps2pdf="`dirname \"$0\"`/ps2pdf$version"
    if test ! -x "$ps2pdf"; then
            ps2pdf="ps2pdf$version"
    fi
    exec "$ps2pdf" "$@"
    Running it produces the output:

    Code:
    dgersic@farfalla:~> /usr/bin/ps2pdf
    /usr/bin/ps2pdf: line 8: /usr/bin/dirname: Permission denied
    /usr/bin/ps2pdf: /usr/bin/ps2pdf14: /bin/sh: bad interpreter: Permission denied
    /usr/bin/ps2pdf: line 12: /usr/bin/ps2pdf14: Success
    I don't see anything wrong with line 8 there. And /bin/sh is perfectly fine. It appears that the only purpose to this script is to set a default output version (14), it then calls a similar script (ps2pdf14) from the same directory.

    If I run it with -x I get:

    Code:
    dgersic@farfalla:~> sh -x ps2pdf
    + version=14
    ++ dirname ps2pdf
    + ps2pdf=./ps2pdf14
    + test '!' -x ./ps2pdf14
    + ps2pdf=ps2pdf14
    + exec ps2pdf14
    /usr/bin/ps2pdf14: line 3: /usr/bin/dirname: Permission denied
    /usr/bin/ps2pdf14: /usr/bin/ps2pdfwr: /bin/sh: bad interpreter: Permission denied
    /usr/bin/ps2pdf14: line 7: /usr/bin/ps2pdfwr: Success
    Similarly, ps2pdf14 is a wrapper for ps2pdfwr. And ps2pdfwr does the same thing. If I run it from the shell, it complains about /usr/bin/dirname and /usr/bin/basename, but if I run it with /bin/sh -x it seems to work correctly.

    I've been staring at this and don't see it. What am I missing here?

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,972

    Default Re: ps2pdf script fail

    While I am as amazed as you are. I note that when you show the sh -x case, you do not call /usr/bin/ps2pdf (as you use the full path in your first case), but ps2pdf. The result of dirname is then . (current working directory), thus I assume that your working directory is /usr/bin in that case.
    Henk van Velden

  3. #3

    Default Re: ps2pdf script fail

    Quote Originally Posted by hcvv View Post
    While I am as amazed as you are. I note that when you show the sh -x case, you do not call /usr/bin/ps2pdf (as you use the full path in your first case), but ps2pdf. The result of dirname is then . (current working directory), thus I assume that your working directory is /usr/bin in that case.
    Sorry, have done both, the results are the same.

    Code:
    dgersic@farfalla:~> /usr/bin/ps2pdf
    /usr/bin/ps2pdf: line 8: /usr/bin/dirname: Permission denied
    /usr/bin/ps2pdf: /usr/bin/ps2pdf14: /bin/sh: bad interpreter: Permission denied
    /usr/bin/ps2pdf: line 12: /usr/bin/ps2pdf14: Success
    dgersic@farfalla:~> sh -x /usr/bin/ps2pdf
    + version=14
    ++ dirname /usr/bin/ps2pdf
    + ps2pdf=/usr/bin/ps2pdf14
    + test '!' -x /usr/bin/ps2pdf14
    + exec /usr/bin/ps2pdf14
    /usr/bin/ps2pdf14: line 3: /usr/bin/dirname: Permission denied
    /usr/bin/ps2pdf14: /usr/bin/ps2pdfwr: /bin/sh: bad interpreter: Permission denied
    /usr/bin/ps2pdf14: line 7: /usr/bin/ps2pdfwr: Success
    /usr/bin is on the path, so the current working directory shouldn't matter. Kind of a weird script the way they're doing this really.

  4. #4
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,972

    Default Re: ps2pdf script fail

    I am not running TW, but for you (and others), I tried in 15.0:
    Code:
    henk@boven:~> ps2pdf
    Usage: ps2pdfwr [options...] (input.[e]ps|-) [output.pdf|-]
    henk@boven:~> which ps2pdf
    /usr/bin/ps2pdf
    henk@boven:~>
    As the obvious error message comes from ps2pdfwr, I guess we can assume that the wrappers work correct and dirname gves no errors here.

    You do not tell what the "older openSuse install" was (I guess something with openSUSE), nor how you upgraded. When you thought it is worth while to mention that you just upgraded (and it is), better tell it all. Else we have only a vague idea that around the corner there might be something ........
    Henk van Velden

  5. #5
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,972

    Default Re: ps2pdf script fail

    Quote Originally Posted by dgersic View Post
    Sorry, have done both, the results are the same.
    I had no doubt about that, but when compairing two tests, one should of course keep the differences to a minimum. Were it only because the interpreters will try to explain every character that is different. My goal was at least partly to help others understanding what they see.

    Quote Originally Posted by dgersic View Post

    /usr/bin is on the path, so the current working directory shouldn't matter. Kind of a weird script the way they're doing this really.
    Again, that is as expected, but it triggered me, specialy because a "normal" user does not often use a system directory as his/her working directory.

    Also the default bash prompt shows to working directory, which your prompt doesn't. Again something to pay attention to when interpreting your CODE snippets.
    Henk van Velden

  6. #6

    Default Re: ps2pdf script fail

    Quote Originally Posted by hcvv View Post
    I am not running TW, but for you (and others), I tried in 15.0:
    Code:
    henk@boven:~> ps2pdf
    Usage: ps2pdfwr [options...] (input.[e]ps|-) [output.pdf|-]
    henk@boven:~> which ps2pdf
    /usr/bin/ps2pdf
    henk@boven:~>
    As the obvious error message comes from ps2pdfwr, I guess we can assume that the wrappers work correct and dirname gves no errors here.

    You do not tell what the "older openSuse install" was (I guess something with openSUSE), nor how you upgraded. When you thought it is worth while to mention that you just upgraded (and it is), better tell it all. Else we have only a vague idea that around the corner there might be something ........
    Interesting. What rpm did your ps2pdf come from?

    It's all failure, all the way down the stack of scripts here.

    Code:
    dgersic@farfalla:~> /usr/bin/ps2pdf14
    /usr/bin/ps2pdf14: line 3: /usr/bin/dirname: Permission denied
    /usr/bin/ps2pdf14: /usr/bin/ps2pdfwr: /bin/sh: bad interpreter: Permission denied
    /usr/bin/ps2pdf14: line 7: /usr/bin/ps2pdfwr: Success
    dgersic@farfalla:~> sh -x /usr/bin/ps2pdf14
    ++ dirname /usr/bin/ps2pdf14
    + ps2pdfwr=/usr/bin/ps2pdfwr
    + test '!' -x /usr/bin/ps2pdfwr
    + exec /usr/bin/ps2pdfwr -dCompatibilityLevel=1.4
    /usr/bin/ps2pdfwr: line 7: /usr/bin/dirname: Permission denied
    /usr/bin/ps2pdfwr: line 24: /usr/bin/basename: Permission denied
    Usage:  [options...] (input.[e]ps|-) [output.pdf|-]
    and:

    Code:
    dgersic@farfalla:~> /usr/bin/ps2pdfwr
    /usr/bin/ps2pdfwr: line 7: /usr/bin/dirname: Permission denied
    /usr/bin/ps2pdfwr: line 24: /usr/bin/basename: Permission denied
    Usage:  [options...] (input.[e]ps|-) [output.pdf|-]
    dgersic@farfalla:~> sh -x /usr/bin/ps2pdfwr
    + GS_EXECUTABLE=gs
    ++ dirname /usr/bin/ps2pdfwr
    + gs=/usr/bin/gs
    + test '!' -x /usr/bin/gs
    + GS_EXECUTABLE=/usr/bin/gs
    + OPTIONS='-P- -dSAFER'
    + true
    + case "$1" in
    + break
    + '[' 0 -lt 1 -o 0 -gt 2 ']'
    ++ basename /usr/bin/ps2pdfwr
    + echo 'Usage: ps2pdfwr [options...] (input.[e]ps|-) [output.pdf|-]'
    Usage: ps2pdfwr [options...] (input.[e]ps|-) [output.pdf|-]
    + exit 1
    The upgrade was from opensuse 11.4. I don't know if that's relevant detail. Upgraded from the Tumbleweed DVD downloaded the night before. The problems I ran in to during the upgrade were with the on-line repos. I was getting sporadic 404 errors when it was trying to fetch upgraded versions. I went with just what was on the DVD and the upgrade progressed fine.

  7. #7
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,972

    Default Re: ps2pdf script fail

    Mine is the standard openSUSE 15.0 one.

    But about your "upgrade". Was that a new install or did you try to use the Upgrade item of the main installer menu?
    In the last case, I doubt very much that such an upgrade is supported (or ever tested in QA). Artifacts of the older installation might create havoc. Difficult to find if that is the case here.

    Let us ask other TW users to test this. Easy enough, just do
    Code:
    ps2pdf
    and post the results. No harm done.
    Henk van Velden

  8. #8

    Default Re: ps2pdf script fail

    Quote Originally Posted by hcvv View Post
    Mine is the standard openSUSE 15.0 one.

    But about your "upgrade". Was that a new install or did you try to use the Upgrade item of the main installer menu?
    In the last case, I doubt very much that such an upgrade is supported (or ever tested in QA). Artifacts of the older installation might create havoc. Difficult to find if that is the case here.

    Let us ask other TW users to test this. Easy enough, just do
    Code:
    ps2pdf
    and post the results. No harm done.
    Upgrade. It required some manual fixes to the packages, changing packman to suse, but otherwise it seems to have worked fine.

    Code:
    dgersic@farfalla:~> rpm -qf /usr/bin/ps2pdf
    ghostscript-9.26a-2.1.x86_64

  9. #9

    Default Re: ps2pdf script fail

    Quote Originally Posted by hcvv View Post
    I had no doubt about that, but when compairing two tests, one should of course keep the differences to a minimum. Were it only because the interpreters will try to explain every character that is different. My goal was at least partly to help others understanding what they see.


    Again, that is as expected, but it triggered me, specialy because a "normal" user does not often use a system directory as his/her working directory.

    Also the default bash prompt shows to working directory, which your prompt doesn't. Again something to pay attention to when interpreting your CODE snippets.
    CWD is /home/dgersic, aka "~", which is shown in the prompt as well.

    Code:
    dgersic@farfalla:~>

  10. #10
    Join Date
    Jul 2008
    Location
    Seattle, WA
    Posts
    17,048

    Default Re: ps2pdf script fail

    I ran an install of TW in a VM, and I get the same errors running ps2pdf
    - looks like a defect to me.

    Jim
    --
    Jim Henderson
    openSUSE Forums Administrator
    Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •