bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] `alias' reusable form breaks with alias NAMES starting with `-'


From: Mingye Wang (Arthur2e5)
Subject: [PATCH] `alias' reusable form breaks with alias NAMES starting with `-'
Date: Wed, 9 Dec 2015 23:11:20 -0500
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0

Bash Version: 4.3
Patch Level: 42

Description:
  `alias' does not `--'-ize alias items with a name starting with a `-'
when it is invoked to print aliases in the reusable form. This causes
`invalid option' errors when trying to reuse these output.

Steps to Reproduce:
  Run the following segment:

  ( unalias -a
    alias -- -a=
    alias
    eval "$(alias)" )

  An `invalid option' error will popup at the final `eval'.

Fix:
  Always stick a `--' into the reusable form:

diff -Naurt bash_/builtins/alias.def bash2/builtins/alias.def
--- bash_/builtins/alias.def    2015-12-09 23:07:42.885174694 -0500
+++ bash2/builtins/alias.def    2015-12-09 23:07:18.681163414 -0500
@@ -232,7 +232,7 @@

   value = sh_single_quote (alias->value);
   if (flags & AL_REUSABLE)
-    printf ("alias ");
+    printf ("alias -- ");
   printf ("%s=%s\n", alias->name, value);
   free (value);

-- 
Regards,

Arthur2e5

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]