Bug 3301 - ssh-copy-id to Solaris 10 or older
Summary: ssh-copy-id to Solaris 10 or older
Status: CLOSED MOVED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh-copy-id (show other bugs)
Version: 8.5p1
Hardware: Other Windows 10
: P5 enhancement
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-20 04:08 AEST by Carlos Rodríguez-Gili
Modified: 2022-02-25 13:58 AEDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Rodríguez-Gili 2021-04-20 04:08:35 AEST
Solaris 10 and older Solaris' /bin/sh is not POSIX.
Using ssh-copy-id fails with the following error:

    sh: test: argument expected

The problem can be solved using double quotes for test -z in the INSTALLKEYS_SH heredoc:

    - { [ -z \`tail -1c ${AUTH_KEY_FILE} 2>/dev/null\` ] ||
    + { [ -z "\`tail -1c ${AUTH_KEY_FILE} 2>/dev/null\`" ] ||

The resulting script seems to work for non-existing, empty, and populated ~/.ssh/authorized_keys files. I don't see the double quotes breaking POSIX (although unnecessary).

I don't think this is a big issue, just thought you might like to know.

BTW it also happens with older versions (before installkeys_sh()).
Comment 1 Jakub Jelen 2021-04-20 20:31:01 AEST
Please, fill this as a MR to https://gitlab.com/phil_hands/ssh-copy-id
Comment 2 Carlos Rodríguez-Gili 2021-04-21 03:41:26 AEST
DONE
Comment 3 Damien Miller 2022-02-25 13:58:33 AEDT
closing bugs resolved before openssh-8.9