boo#1210974 and not escape leading tilde and backslashes

OBS-URL: https://build.opensuse.org/package/show/shells/bash-completion?expand=0&rev=132
This commit is contained in:
Dr. Werner Fink 2023-08-17 12:33:28 +00:00 committed by Git OBS Bridge
parent 4e329dff68
commit 9399e26624
5 changed files with 61 additions and 7 deletions

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Thu Aug 17 12:28:28 UTC 2023 - Dr. Werner Fink <werner@suse.de>
- Modify patches
* ls-completion-boo889319.patch
* rm-completion-smart-boo958462.patch
to avoid skipping spaces after last word on command line (boo#1210974)
- Add patch fix_quote_readline_by_ref.patch
* Do not escape leading ~ nor backslash and avoid empty quoting
-------------------------------------------------------------------
Sun Apr 2 10:26:09 UTC 2023 - Callum Farmer <gmbr3@opensuse.org>

View File

@ -1,7 +1,7 @@
#
# spec file for package bash
# spec file
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -72,6 +72,8 @@ Patch13: boo1190929-9af4afd0.patch
Patch14: bsc1199724-modules.patch
# PATCH-FIX-UPSTREAM bsc#1200791
Patch15: fix-curl-help-completion-bsc1200791.patch
# PATCH-FIX-SUSE -- avoid broken quotes ands escapes
Patch16: fix_quote_readline_by_ref.patch
BuildRequires: libtool
BuildRequires: pkgconfig
BuildArch: noarch

View File

@ -0,0 +1,43 @@
From: JuanJo Ciarlante <jjo@canonical.com>
Subject: fix _quote_readline_by_ref to:
- avoid escaping 1st '~' (lp: #1288314)
- avoid quoting if empty, else expansion without args only shows dirs
(lp: #1288031)
- replace double escaping to single (eg for completing file/paths with
spaces)
Origin: vendor, https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=739835
Bug-Debian: https://bugs.debian.org/739835
Forwarded: yes, <5328F418.100@canonical.com>
---
bash_completion | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
--- a/bash_completion
+++ b/bash_completion 2023-08-17 12:16:26.654187550 +0000
@@ -542,13 +542,24 @@ __ltrim_colon_completions()
# @param $2 Name of variable to return result to
_quote_readline_by_ref()
{
- if [[ $1 == \'* ]]; then
+ if [ -z "$1" ]; then
+ # avoid quoting if empty
+ printf -v $2 %s "$1"
+ elif [[ $1 == \'* ]]; then
# Leave out first character
printf -v $2 %s "${1:1}"
+ elif [[ $1 == ~* ]]; then
+ # avoid escaping first ~
+ printf -v $2 ~%q "${1:1}"
else
printf -v $2 %q "$1"
fi
+ # Replace double escaping ( \\ ) by single ( \ )
+ # This happens always when argument is already escaped at cmdline,
+ # and passed to this function as e.g.: file\ with\ spaces
+ [[ ${!2} == *\\* ]] && printf -v $2 %s "${1//\\\\/\\}"
+
# If result becomes quoted like this: $'string', re-evaluate in order to
# drop the additional quoting. See also:
# https://www.mail-archive.com/bash-completion-devel@lists.alioth.debian.org/msg01942.html

View File

@ -16,7 +16,7 @@ Index: bash-completion-2.11/bash_completion
sed sha{,1,224,256,384,512}sum shar sort split strip sum tac tail tee \
texindex touch tr unexpand uniq vdir wc who
complete -F _longopt -o default env netstat seq uname units
+complete -F _longopt -o bashdefault -o default -o filenames -o nospace ls ll la l ls-l lf
+complete -F _longopt -o bashdefault -o default -o filenames ls ll la l ls-l lf
declare -Ag _xspecs

View File

@ -11,7 +11,7 @@ Index: bash-completion-2.11/bash_completion
===================================================================
--- bash-completion-2.11.orig/bash_completion
+++ bash-completion-2.11/bash_completion
@@ -2096,11 +2096,13 @@ _longopt()
@@ -2096,11 +2096,12 @@ _longopt()
complete -F _longopt -o filenames a2ps awk base64 bash bc bison cat chroot colordiff cp \
csplit cut date df diff dir du enscript expand fmt fold gperf \
grep grub head irb ld ldd less ln m4 md5sum mkdir mkfifo mknod \
@ -20,9 +20,8 @@ Index: bash-completion-2.11/bash_completion
sed sha{,1,224,256,384,512}sum shar sort split strip sum tac tail tee \
texindex touch tr unexpand uniq vdir wc who
complete -F _longopt -o default env netstat seq uname units
complete -F _longopt -o bashdefault -o default -o filenames -o nospace ls ll la l ls-l lf
+complete -F _longopt -o bashdefault -o default -o filenames -o nospace rm rmdir
+
complete -F _longopt -o bashdefault -o default -o filenames ls ll la l ls-l lf
+complete -F _longopt -o bashdefault -o default -o filenames rm rmdir
declare -Ag _xspecs