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

Bug#640789: Crash on folder name with spaces



Control: tags -1 patch

Hello,

Trečiadienis 07 Rugsėjis 2011 11:57:14 rašė:
> It seems that an unescaped $dir in debian/iso-scan.postinst makes
> iso-scan exit while searching for iso images, if a folder name
> contains spaces.
> 
> line 165:
> isolist=$(find $dir $opt -name "*.iso" -o -name "*.ISO" 2>/dev/null)

The patch is attached. I have been hit by this today and have spent hours 
trying to understand what was going on.

-- 
Modestas Vainius <modax@debian.org>
>From 650fb20f67028f92c0a36acd2a95fc45bc8ae361 Mon Sep 17 00:00:00 2001
From: Modestas Vainius <modax@debian.org>
Date: Sun, 29 Dec 2013 15:47:31 +0200
Subject: [PATCH] Escape directory path when invoking `find`.

Closes: #640789.
---
 debian/changelog         | 7 +++++++
 debian/iso-scan.postinst | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index fbdd6b7..eecbdcf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+iso-scan (1.52) UNRELEASED; urgency=medium
+
+  * Do not crash when searching in folders with shell-special characters in
+    their name. (Closes: #640789)
+
+ -- Modestas Vainius <modax@debian.org>  Sun, 29 Dec 2013 15:49:15 +0200
+
 iso-scan (1.51) unstable; urgency=low
 
   [ Updated translations ]
diff --git a/debian/iso-scan.postinst b/debian/iso-scan.postinst
index 1255214..a21ed85 100755
--- a/debian/iso-scan.postinst
+++ b/debian/iso-scan.postinst
@@ -162,7 +162,7 @@ scan_device_for_isos() {
 			elif [ "$look_subdirs" = 1 ]; then
 				opt="-type f"
 			fi
-			isolist=$(find $dir $opt -name "*.iso" -o -name "*.ISO" 2>/dev/null)
+			isolist=$(find "$dir" $opt -name "*.iso" -o -name "*.ISO" 2>/dev/null)
 			TOPLEVEL_DIRS_COUNT=$(($TOPLEVEL_DIRS_COUNT + 1))
 
 			for iso in $isolist; do
-- 
1.8.5.2

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: