[pacman-dev] [PATCH] makepkg: quote arrays in order to preserve spaces in array items
Fixes FS#16871. Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 92b0454..8ca89e1 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1315,7 +1315,7 @@ devel_update() { backup_package_variables() { for var in ${splitpkg_overrides[@]}; do indirect="${var}_backup" - eval "${indirect}=(\${$var[@]})" + eval "${indirect}=(\"\${$var[@]}\")" done } @@ -1323,7 +1323,7 @@ restore_package_variables() { for var in ${splitpkg_overrides[@]}; do indirect="${var}_backup" if [ -n "${!indirect}" ]; then - eval "${var}=(\${$indirect[@]})" + eval "${var}=(\"\${$indirect[@]}\")" else unset ${var} fi -- 1.6.5.2
Cedric Staniewski wrote:
Fixes FS#16871.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 92b0454..8ca89e1 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1315,7 +1315,7 @@ devel_update() { backup_package_variables() { for var in ${splitpkg_overrides[@]}; do indirect="${var}_backup" - eval "${indirect}=(\${$var[@]})" + eval "${indirect}=(\"\${$var[@]}\")" done }
@@ -1323,7 +1323,7 @@ restore_package_variables() { for var in ${splitpkg_overrides[@]}; do indirect="${var}_backup" if [ -n "${!indirect}" ]; then - eval "${var}=(\${$indirect[@]})" + eval "${var}=(\"\${$indirect[@]}\")" else unset ${var} fi
Looks good. This will also fix the pkgdesc issues that are worked around at the end of the restore_package_variables function so you can delete those few lines too. Allan
Allan McRae wrote:
Cedric Staniewski wrote:
Fixes FS#16871.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 92b0454..8ca89e1 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1315,7 +1315,7 @@ devel_update() { backup_package_variables() { for var in ${splitpkg_overrides[@]}; do indirect="${var}_backup" - eval "${indirect}=(\${$var[@]})" + eval "${indirect}=(\"\${$var[@]}\")" done }
@@ -1323,7 +1323,7 @@ restore_package_variables() { for var in ${splitpkg_overrides[@]}; do indirect="${var}_backup" if [ -n "${!indirect}" ]; then - eval "${var}=(\${$indirect[@]})" + eval "${var}=(\"\${$indirect[@]}\")" else unset ${var} fi
Looks good. This will also fix the pkgdesc issues that are worked around at the end of the restore_package_variables function so you can delete those few lines too.
Allan
Right, thanks.
From b2f582678e2f3d8cfce1dd0a343e988b35f58d8e Mon Sep 17 00:00:00 2001 -- 8< -- From: Cedric Staniewski <cedric@gmx.ca> Date: Thu, 5 Nov 2009 17:27:34 +0100 Subject: [PATCH] makepkg: quote arrays in order to preserve spaces in array items
Fixes FS#16871 and makes the pkgdesc workaround obsolete. Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 92b0454..25fb8d9 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1315,7 +1315,7 @@ devel_update() { backup_package_variables() { for var in ${splitpkg_overrides[@]}; do indirect="${var}_backup" - eval "${indirect}=(\${$var[@]})" + eval "${indirect}=(\"\${$var[@]}\")" done } @@ -1323,16 +1323,11 @@ restore_package_variables() { for var in ${splitpkg_overrides[@]}; do indirect="${var}_backup" if [ -n "${!indirect}" ]; then - eval "${var}=(\${$indirect[@]})" + eval "${var}=(\"\${$indirect[@]}\")" else unset ${var} fi done - - # pkgdesc gets restored as an array - convert back to a string - local pkgdesc_backup="${pkgdesc[@]}" - unset pkgdesc - pkgdesc=${pkgdesc_backup} } # getopt like parser -- 1.6.5.2
Cedric Staniewski wrote:
Allan McRae wrote:
Cedric Staniewski wrote:
Fixes FS#16871.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 92b0454..8ca89e1 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1315,7 +1315,7 @@ devel_update() { backup_package_variables() { for var in ${splitpkg_overrides[@]}; do indirect="${var}_backup" - eval "${indirect}=(\${$var[@]})" + eval "${indirect}=(\"\${$var[@]}\")" done }
@@ -1323,7 +1323,7 @@ restore_package_variables() { for var in ${splitpkg_overrides[@]}; do indirect="${var}_backup" if [ -n "${!indirect}" ]; then - eval "${var}=(\${$indirect[@]})" + eval "${var}=(\"\${$indirect[@]}\")" else unset ${var} fi Looks good. This will also fix the pkgdesc issues that are worked around at the end of the restore_package_variables function so you can delete those few lines too.
Allan
Right, thanks.
From b2f582678e2f3d8cfce1dd0a343e988b35f58d8e Mon Sep 17 00:00:00 2001 -- 8< -- From: Cedric Staniewski <cedric@gmx.ca> Date: Thu, 5 Nov 2009 17:27:34 +0100 Subject: [PATCH] makepkg: quote arrays in order to preserve spaces in array items
Fixes FS#16871 and makes the pkgdesc workaround obsolete.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> ---
Pushed to my working branch. Thanks, Allan
Allan McRae wrote:
Cedric Staniewski wrote:
Allan McRae wrote:
Cedric Staniewski wrote:
Fixes FS#16871.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 92b0454..8ca89e1 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1315,7 +1315,7 @@ devel_update() { backup_package_variables() { for var in ${splitpkg_overrides[@]}; do indirect="${var}_backup" - eval "${indirect}=(\${$var[@]})" + eval "${indirect}=(\"\${$var[@]}\")" done }
@@ -1323,7 +1323,7 @@ restore_package_variables() { for var in ${splitpkg_overrides[@]}; do indirect="${var}_backup" if [ -n "${!indirect}" ]; then - eval "${var}=(\${$indirect[@]})" + eval "${var}=(\"\${$indirect[@]}\")" else unset ${var} fi Looks good. This will also fix the pkgdesc issues that are worked around at the end of the restore_package_variables function so you can delete those few lines too.
Allan
Right, thanks.
From b2f582678e2f3d8cfce1dd0a343e988b35f58d8e Mon Sep 17 00:00:00 2001 -- 8< -- From: Cedric Staniewski <cedric@gmx.ca> Date: Thu, 5 Nov 2009 17:27:34 +0100 Subject: [PATCH] makepkg: quote arrays in order to preserve spaces in array items
Fixes FS#16871 and makes the pkgdesc workaround obsolete.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> ---
Pushed to my working branch.
Thanks, Allan
I have noticed you shortened the commit message (on purpose?). Just in case you do not know this git feature, I started using scissors lines for inline patches. My patches should therefore apply with a clean commit message when using git am -c or having mailinfo.scissors set to true.
Cedric Staniewski wrote:
Allan McRae wrote:
Cedric Staniewski wrote:
Allan McRae wrote:
Cedric Staniewski wrote:
Fixes FS#16871.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 92b0454..8ca89e1 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1315,7 +1315,7 @@ devel_update() { backup_package_variables() { for var in ${splitpkg_overrides[@]}; do indirect="${var}_backup" - eval "${indirect}=(\${$var[@]})" + eval "${indirect}=(\"\${$var[@]}\")" done }
@@ -1323,7 +1323,7 @@ restore_package_variables() { for var in ${splitpkg_overrides[@]}; do indirect="${var}_backup" if [ -n "${!indirect}" ]; then - eval "${var}=(\${$indirect[@]})" + eval "${var}=(\"\${$indirect[@]}\")" else unset ${var} fi Looks good. This will also fix the pkgdesc issues that are worked around at the end of the restore_package_variables function so you can delete those few lines too.
Allan Right, thanks.
From b2f582678e2f3d8cfce1dd0a343e988b35f58d8e Mon Sep 17 00:00:00 2001 -- 8< -- From: Cedric Staniewski <cedric@gmx.ca> Date: Thu, 5 Nov 2009 17:27:34 +0100 Subject: [PATCH] makepkg: quote arrays in order to preserve spaces in array items
Fixes FS#16871 and makes the pkgdesc workaround obsolete.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- Pushed to my working branch.
Thanks, Allan
I have noticed you shortened the commit message (on purpose?). Just in case you do not know this git feature, I started using scissors lines for inline patches. My patches should therefore apply with a clean commit message when using git am -c or having mailinfo.scissors set to true.
Not on purpose... sorry, fixed. And I did not know that feature (I have been git am, then git commit --amend and deleting the crap at the top. I guess I held "d" in vim too long that time. git am -c is new to me and that seems very useful. How do you put the scissors there in the first place?
Allan McRae wrote:
Cedric Staniewski wrote:
Allan McRae wrote:
Cedric Staniewski wrote:
Allan McRae wrote:
Cedric Staniewski wrote:
Fixes FS#16871.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 92b0454..8ca89e1 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1315,7 +1315,7 @@ devel_update() { backup_package_variables() { for var in ${splitpkg_overrides[@]}; do indirect="${var}_backup" - eval "${indirect}=(\${$var[@]})" + eval "${indirect}=(\"\${$var[@]}\")" done }
@@ -1323,7 +1323,7 @@ restore_package_variables() { for var in ${splitpkg_overrides[@]}; do indirect="${var}_backup" if [ -n "${!indirect}" ]; then - eval "${var}=(\${$indirect[@]})" + eval "${var}=(\"\${$indirect[@]}\")" else unset ${var} fi Looks good. This will also fix the pkgdesc issues that are worked around at the end of the restore_package_variables function so you can delete those few lines too.
Allan Right, thanks.
From b2f582678e2f3d8cfce1dd0a343e988b35f58d8e Mon Sep 17 00:00:00 2001 -- 8< -- From: Cedric Staniewski <cedric@gmx.ca> Date: Thu, 5 Nov 2009 17:27:34 +0100 Subject: [PATCH] makepkg: quote arrays in order to preserve spaces in array items
Fixes FS#16871 and makes the pkgdesc workaround obsolete.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- Pushed to my working branch.
Thanks, Allan
I have noticed you shortened the commit message (on purpose?). Just in case you do not know this git feature, I started using scissors lines for inline patches. My patches should therefore apply with a clean commit message when using git am -c or having mailinfo.scissors set to true.
Not on purpose... sorry, fixed. And I did not know that feature (I have been git am, then git commit --amend and deleting the crap at the top. I guess I held "d" in vim too long that time.
git am -c is new to me and that seems very useful. How do you put the scissors there in the first place?
Manually. Maybe it is possible to add it automatically, but I do not know a way to achieve this so far. Unfortunately, format-patch --add-header='-- 8< --' puts the line below the other header lines which is useless when the subject of the mail does not match the patch's subject (git uses the data from the mail header when there is no From/Date/Subject header in the patch). However, make sure you to put the scissors line below the first line ("From ... Mon Sep 17 00:00:00 2001") otherwise git does not recognize the patch.
Fixes FS#16871.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 92b0454..8ca89e1 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1315,7 +1315,7 @@ devel_update() { backup_package_variables() { for var in ${splitpkg_overrides[@]}; do indirect="${var}_backup" - eval "${indirect}=(\${$var[@]})" + eval "${indirect}=(\"\${$var[@]}\")" done } @@ -1323,7 +1323,7 @@ restore_package_variables() { for var in ${splitpkg_overrides[@]}; do indirect="${var}_backup" if [ -n "${!indirect}" ]; then - eval "${var}=(\${$indirect[@]})" + eval "${var}=(\"\${$indirect[@]}\")" else unset ${var} fi
I'm not familiar with this segment of the code, but I feel compelled to point out that, while making a patch to fix issues with spaces in arrays, you fail to preserve spaces in splitpkg_overrides. The code should have: - for var in ${splitpkg_overrides[@]}; do + for var in "${splitpkg_overrides[@]}"; do
Isaac Good wrote:
Fixes FS#16871.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 92b0454..8ca89e1 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1315,7 +1315,7 @@ devel_update() { backup_package_variables() { for var in ${splitpkg_overrides[@]}; do indirect="${var}_backup" - eval "${indirect}=(\${$var[@]})" + eval "${indirect}=(\"\${$var[@]}\")" done } @@ -1323,7 +1323,7 @@ restore_package_variables() { for var in ${splitpkg_overrides[@]}; do indirect="${var}_backup" if [ -n "${!indirect}" ]; then - eval "${var}=(\${$indirect[@]})" + eval "${var}=(\"\${$indirect[@]}\")" else unset ${var} fi
I'm not familiar with this segment of the code, but I feel compelled to point out that, while making a patch to fix issues with spaces in arrays, you fail to preserve spaces in splitpkg_overrides. The code should have:
- for var in ${splitpkg_overrides[@]}; do + for var in "${splitpkg_overrides[@]}"; do
I thought about that too, but decided against it because I suspect we will never have variable names which contain spaces. So it does not matter, but feel free to 'fix' it in a add-quotes-everywhere-patch.
splitpkg_overrides=('pkgver' 'pkgrel' 'pkgdesc' 'arch' 'license' 'groups' \ 'depends' 'optdepends' 'provides' 'conflicts' 'replaces' \ 'backup' 'options' 'install' 'changelog')
Isaac Good wrote:
Fixes FS#16871.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 92b0454..8ca89e1 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1315,7 +1315,7 @@ devel_update() { backup_package_variables() { for var in ${splitpkg_overrides[@]}; do indirect="${var}_backup" - eval "${indirect}=(\${$var[@]})" + eval "${indirect}=(\"\${$var[@]}\")" done } @@ -1323,7 +1323,7 @@ restore_package_variables() { for var in ${splitpkg_overrides[@]}; do indirect="${var}_backup" if [ -n "${!indirect}" ]; then - eval "${var}=(\${$indirect[@]})" + eval "${var}=(\"\${$indirect[@]}\")" else unset ${var} fi
I'm not familiar with this segment of the code, but I feel compelled to point out that, while making a patch to fix issues with spaces in arrays, you fail to preserve spaces in splitpkg_overrides. The code should have:
- for var in ${splitpkg_overrides[@]}; do + for var in "${splitpkg_overrides[@]}"; do
There are no spaces in splitpkg_overrides: splitpkg_overrides=('pkgver' 'pkgrel' 'pkgdesc' 'arch' 'license' 'groups' \ 'depends' 'optdepends' 'provides' 'conflicts' 'replaces' \ 'backup' 'options' 'install' 'changelog')
participants (3)
-
Allan McRae
-
Cedric Staniewski
-
Isaac Good