[sr #111102] ksh93 oddity w.r.t. ${1+"$@"} on AIX (for section "Portable Shell"?)

anonymous <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.bugs
Message-ID <[email protected]>
URL:
  <https://savannah.gnu.org/support/?111102>

                 Summary: ksh93 oddity w.r.t. ${1+"$@"} on AIX (for section
"Portable Shell"?)
                   Group: Autoconf
               Submitter: None
               Submitted: Fri 02 Aug 2024 03:16:59 PM UTC
                Priority: 5 - Unprioritized
                Severity: 3 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: [email protected]
             Open/Closed: Open
         Discussion Lock: Any
        Operating System: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Fri 02 Aug 2024 03:16:59 PM UTC By: Anonymous
I know you already recommend not to use ${1+"$@"} in section "Portable Shell"
-> "Shell Substitutions" of the info manual.

Here might be another reason why: Certain ksh version on AIX drop trailing
empty arguments when expanding ${1+"$@"}.  Like this:


$ uname -a
AIX host 2 7 00F7BD2A4C00
$ echo ${.sh.version}
Version M 93t+ 2009-05-01
$ set x foo bar baz ""
$ shift 1
$ echo $#
4
$ set x ${1+"$@"}
$ shift 1
$ echo $#
3
$ echo ":$1:$2:$3:"  
:foo:bar:baz:


When using regular "$@" things work as expected:


$ set x foo bar baz ""
$ shift 1
$ echo $#
4
$ set x "$@"
$ shift 1
$ echo $#
4


Probably worth mentioning in the info manual?

Thanks!








    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/support/?111102>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCZqz4bgAKCRCqLAuaBUf3
ThqFAP9r4Ix7et5xuYF7h7hJzLOboaPoFteeAViDKTLpmdd0PwEAh++lFCQgJlcB
VjXGMrND1OlQ+VyikEUKRbSfBgGLFQY=
=e8YP
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.