Package: libpmount
Severity: normal
Tags: patch

Hi!

Attached patch fixes:

  - check target in Makefile (syntax errors)
  - ext2fs.sh (attempts to link with -Lout where it should be -L.)

I also added a pair of improvements:

  - ext2fs.sh cleanup to reduce number of fs-specific bits
  - add isofs.sh

It should be noted that neither of the tests work on GNU/kFreeBSD, but this is
just because kFreeBSD moved to a new mount kerncall (SYS_nmount).

-- System Information:
Debian Release: testing/unstable
Architecture: kfreebsd-i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: GNU/kFreeBSD 5.3-1
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C)
diff -Nur libpmount-0.0.6.old/Makefile libpmount-0.0.6/Makefile
--- libpmount-0.0.6.old/Makefile	2005-06-05 15:39:54.000000000 +0200
+++ libpmount-0.0.6/Makefile	2005-08-15 17:24:43.000000000 +0200
@@ -31,9 +31,9 @@
 check: build
 	# check if we are root, and it's not fake
 	if test `id -u` = 0 && test -z "$(FAKEROOTKEY)"; then \
-	  for i in tests/*.sh; do sh $i; done \
+	  for i in tests/*.sh; do sh $$i ; done ; \
 	else \
-	  echo "Not running as root, skipping checks." \
+	  echo "Not running as root, skipping checks." ; \
 	fi
 
 install: build
@@ -52,4 +52,4 @@
 	$(RM) $(SH_OBJS)
 	$(RM) $(SONAME)
 	$(RM) $(LIBNAME)
-
+	$(RM) -r tmp
diff -Nur libpmount-0.0.6.old/tests/ext2fs.sh libpmount-0.0.6/tests/ext2fs.sh
--- libpmount-0.0.6.old/tests/ext2fs.sh	2004-12-14 07:18:03.000000000 +0100
+++ libpmount-0.0.6/tests/ext2fs.sh	2005-08-15 17:27:04.000000000 +0200
@@ -1,23 +1,26 @@
 #!/bin/sh -e
 
+fsname="ext2fs"
+
 export PATH="/sbin:/usr/sbin:$PATH"
-export CFLAGS="-Isrc -Lout -lpmount"
+export CFLAGS="-Isrc -L. -lpmount"
 
-dd if=/dev/zero of=tmp/ext2fs.img bs=1024k count=1
-mke2fs -F tmp/ext2fs.img
-mkdir -p tmp/ext2fs.mnt
-cat > tmp/ext2fs.c << EOF
+mkdir -p tmp
+dd if=/dev/zero of=tmp/${fsname}.img bs=1024k count=1
+mke2fs -F tmp/${fsname}.img
+mkdir -p tmp/${fsname}.mnt
+cat > tmp/${fsname}.c << EOF
 #include <pmount.h>
 #include <stdio.h>
 main ()
   {
-    if (pmount ("ext2fs", "tmp/ext2fs.mnt", PMOUNT_READONLY,
-                "tmp/ext2fs.img") == -1)
+    if (pmount ("${fsname}", "tmp/${fsname}.mnt", PMOUNT_READONLY,
+                "tmp/${fsname}.img") == -1)
       {
         perror ("pmount failed");
         return -1;
       }
-    if (pumount ("tmp/ext2fs.mnt", 0) == -1)
+    if (pumount ("tmp/${fsname}.mnt", 0) == -1)
       {
         perror ("WARNING: pmount succeeded, but pumount failed");
         return -1;
@@ -25,5 +28,5 @@
     return 0;
   }
 EOF
-gcc tmp/ext2fs.c -o tmp/ext2fs.bin $CFLAGS
-./tmp/ext2fs.bin
+gcc tmp/${fsname}.c -o tmp/${fsname}.bin $CFLAGS
+./tmp/${fsname}.bin
diff -Nur libpmount-0.0.6.old/tests/isofs.sh libpmount-0.0.6/tests/isofs.sh
--- libpmount-0.0.6.old/tests/isofs.sh	1970-01-01 01:00:00.000000000 +0100
+++ libpmount-0.0.6/tests/isofs.sh	2005-08-15 17:27:13.000000000 +0200
@@ -0,0 +1,31 @@
+#!/bin/sh -e
+
+fsname="isofs"
+
+export CFLAGS="-Isrc -L. -lpmount"
+
+mkdir -p tmp
+dd if=/dev/zero of=tmp/${fsname}.dummy bs=1024k count=1
+mkisofs -o tmp/${fsname}.img -r tmp/${fsname}.dummy
+mkdir -p tmp/${fsname}.mnt
+cat > tmp/${fsname}.c << EOF
+#include <pmount.h>
+#include <stdio.h>
+main ()
+  {
+    if (pmount ("${fsname}", "tmp/${fsname}.mnt", PMOUNT_READONLY,
+                "tmp/${fsname}.img") == -1)
+      {
+        perror ("pmount failed");
+        return -1;
+      }
+    if (pumount ("tmp/${fsname}.mnt", 0) == -1)
+      {
+        perror ("WARNING: pmount succeeded, but pumount failed");
+        return -1;
+      }
+    return 0;
+  }
+EOF
+gcc tmp/${fsname}.c -o tmp/${fsname}.bin $CFLAGS
+./tmp/${fsname}.bin

Reply via email to