ports/116292: sysutils/cramfs patches for mkcramfs/cramfsck

Christopher Hall freebsd at generalresources.com
Wed Sep 12 00:00:05 UTC 2007


>Number:         116292
>Category:       ports
>Synopsis:       sysutils/cramfs patches for mkcramfs/cramfsck
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 12 00:00:04 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Christopher Hall
>Release:        6.2 stable
>Organization:
>Environment:
FreeBSD 6.2-RELEASE-p7 i386
>Description:
1. mkcramfs always fails with invalid fd on the first mmap call
   caused by MAP_ANONYMOUS being defined as a number
   when MAP_ANON should be used

2. cramfsck -x fails when trying to extract an image containing a FIFO
   caused by mknod being unable to create a FIFO
   mkfifo should be used

>How-To-Repeat:
1. mkcramfs dir image-file
2. cramfsck -x new-dir file.image

>Fix:
diff -urN cramfs.orig/files/patch-cramfsck.c cramfs/files/patch-cramfsck.c
--- cramfs.orig/files/patch-cramfsck.c	Thu Dec  7 17:36:45 2006
+++ cramfs/files/patch-cramfsck.c	Mon Sep 10 15:41:55 2007
@@ -17,3 +17,23 @@
  
  /* Exit codes used by fsck-type programs */
  #define FSCK_OK          0	/* No errors */
+@@ -603,8 +603,17 @@
+ 	}
+ 
+ 	if (opt_extract) {
+-		if (mknod(path, i->mode, devtype) < 0) {
+-			die(FSCK_ERROR, 1, "mknod failed: %s", path);
++		switch(type) {
++		default:
++			if (mknod(path, i->mode, devtype) < 0) {
++				die(FSCK_ERROR, 1, "mknod failed: %s", path);
++			}
++			break;
++		case 'p':
++			if (mkfifo(path, i->mode) < 0) {
++				die(FSCK_ERROR, 1, "mkfifo failed: %s", path);
++			}
++			break;
+ 		}
+ 		change_file_status(path, i);
+ 	}
diff -urN cramfs.orig/files/patch-mkcramfs.c cramfs/files/patch-mkcramfs.c
--- cramfs.orig/files/patch-mkcramfs.c	Thu Dec  7 17:36:45 2006
+++ cramfs/files/patch-mkcramfs.c	Tue Sep 11 08:42:40 2007
@@ -4,7 +4,7 @@
  #include <linux/cramfs_fs.h>
  #include <zlib.h>
  
-+#define	MAP_ANONYMOUS	0x20
++#define	MAP_ANONYMOUS	MAP_ANON
 +typedef	long long	loff_t;
 +
  /* Exit codes used by mkfs-type programs */





>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list