Skip to content

Commit

Permalink
Fixed argument handling in the .desktop file (bsc#1087352)
Browse files Browse the repository at this point in the history
... for the "Install/Remove Software" item
- Properly process paths contaning spaces or special shell characters
- 4.0.62
  • Loading branch information
lslezak committed May 16, 2018
1 parent d001ff0 commit f1ae3a2
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
5 changes: 4 additions & 1 deletion desktop/yast2-packager.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
Encoding=UTF-8
Name=Install/Remove Software
GenericName=Install/Remove Software
Exec=xdg-su -c "/sbin/yast2 sw_single %F"
# we cannot use xdg-su -c "/sbin/yast2 sw_single %F"
# directly here as %F must not be used inside a quoted argument
# see https://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables
Exec=/usr/lib/YaST2/bin/sw_single_wrapper %F
Icon=yast-sw_single
Terminal=false
Type=Application
Expand Down
9 changes: 9 additions & 0 deletions package/yast2-packager.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
-------------------------------------------------------------------
Wed May 16 11:35:45 UTC 2018 - lslezak@suse.cz

- Fixed argument handling in the .desktop file for the
"Install/Remove Software" item (bsc#1087352)
- Properly process paths contaning spaces or special shell
characters
- 4.0.62

-------------------------------------------------------------------
Thu May 3 14:02:55 UTC 2018 - lslezak@suse.cz

Expand Down
4 changes: 3 additions & 1 deletion package/yast2-packager.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-packager
Version: 4.0.61
Version: 4.0.62
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down Expand Up @@ -134,6 +134,8 @@ rake install DESTDIR="%{buildroot}"
%dir %{yast_libdir}/packager
%dir %{yast_libdir}/packager/cfa
%dir %{yast_libdir}/y2packager
%dir %{yast_ybindir}
%{yast_ybindir}/*
%{yast_yncludedir}/checkmedia/*
%{yast_yncludedir}/packager/*
%{yast_libdir}/packager/*
Expand Down
17 changes: 17 additions & 0 deletions src/bin/sw_single_wrapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#! /bin/sh

# This is a small wrapper around "yast2 sw_single"
# which quotes all arguments before passing them
# to xdg-su (to properly process file names contaning
# spaces or special shell characters like quotes, ampersand...)

# quote all argumets, they will be used inside double quotes
$ARGS=""
for ARG in "$@"
do
QUOTED_ARG=`printf '%q' "$ARG"`
ARGS="$ARGS $QUOTED_ARG"
done

xdg-su -c "/sbin/yast2 sw_single $ARGS"

0 comments on commit f1ae3a2

Please sign in to comment.