summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Volkov <pva@gentoo.org>2009-06-20 13:55:19 +0000
committerPeter Volkov <pva@gentoo.org>2009-06-20 13:55:19 +0000
commitb0e8c728985345b6273217a6009b5ecf5e89bf62 (patch)
tree7db040f9333471c86602ddeba3ce5ec55ffbc911 /app-misc/fdupes/files
parentStable for HPPA (bug #274666). (diff)
downloadgentoo-2-b0e8c728985345b6273217a6009b5ecf5e89bf62.tar.gz
gentoo-2-b0e8c728985345b6273217a6009b5ecf5e89bf62.tar.bz2
gentoo-2-b0e8c728985345b6273217a6009b5ecf5e89bf62.zip
Fixed another regression cause by md5sum-external USE flag, bug #273597, thank Sven Wehner for detailed report.
(Portage version: 2.2_rc33/cvs/Linux i686)
Diffstat (limited to 'app-misc/fdupes/files')
-rw-r--r--app-misc/fdupes/files/fdupes-1.40-external-md5sum-quotation-1.patch72
1 files changed, 72 insertions, 0 deletions
diff --git a/app-misc/fdupes/files/fdupes-1.40-external-md5sum-quotation-1.patch b/app-misc/fdupes/files/fdupes-1.40-external-md5sum-quotation-1.patch
new file mode 100644
index 000000000000..1815f7b6d152
--- /dev/null
+++ b/app-misc/fdupes/files/fdupes-1.40-external-md5sum-quotation-1.patch
@@ -0,0 +1,72 @@
+Source: Peter Volkov <pva@gentoo.org>
+Upstream: notified (sent email to <adrian2 AT caribe DOT net>
+Reason: bugs.gentoo.org/237828 comment #1
+With USE=md5sum-external fails on filenames with spaces in their names.
+
+Updated on 2009/06/20:
+ * Fixed free due to wrong length of memory allocation bugs.gentoo.org/273597
+ * Now works with filename that have " in name...
+
+--- fdupes.c 2009-06-20 10:51:31 +0000
++++ fdupes.c 2009-06-20 13:38:39 +0000
+@@ -291,17 +291,48 @@
+ char *getcrcsignature(char *filename)
+ {
+ static char signature[256];
++ char *backslashedfilename;
+ char *command;
+ char *separator;
+ FILE *result;
+-
+- command = (char*) malloc(strlen(filename)+strlen(EXTERNAL_MD5)+2);
++ int i=0;
++ int j=0;
++ int numofquotes=0;
++
++ /* Find number of " in filename */
++ while ( filename[i] != '\0' ) {
++ if ( filename[i] == '\"' )
++ numofquotes++;
++ i++;
++ }
++
++ backslashedfilename = (char*) malloc(strlen(filename)+numofquotes+1);
++ if (backslashedfilename == NULL) {
++ errormsg("out of memory\n");
++ exit(1);
++ }
++
++ /* Put backslash before each " */
++ i=0;
++ while ( filename[i] != '\0' ) {
++ if ( filename[i] == '\"' ) {
++ backslashedfilename[j]='\\';
++ j++;
++ }
++ backslashedfilename[j]=filename[i];
++ i++;
++ j++;
++ }
++ backslashedfilename[j]='\0';
++
++ command = (char*) malloc(strlen(backslashedfilename)+strlen(EXTERNAL_MD5)+6);
+ if (command == NULL) {
+ errormsg("out of memory\n");
+ exit(1);
+ }
+
+- sprintf(command, "%s %s", EXTERNAL_MD5, filename);
++ /* Qoutation required to works spaces in filenames */
++ sprintf(command, "%s \"%s\"", EXTERNAL_MD5, backslashedfilename);
+
+ result = popen(command, "r");
+ if (result == NULL) {
+@@ -309,6 +340,7 @@
+ exit(1);
+ }
+
++ free(backslashedfilename);
+ free(command);
+
+ if (fgets(signature, 256, result) == NULL) {
+