Bug 52452 - [PATCH] sysutils/afio mangles FIFOs
[PATCH] sysutils/afio mangles FIFOs
Status: Closed FIXED
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s)
Latest
Any Any
: Normal Affects Only Me
Assigned To: FreeBSD ports mailing list
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2003-05-20 02:40 UTC by oremanj
Modified: 2003-09-30 00:36 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description oremanj 2003-05-20 02:40:10 UTC
When run under FreeBSD, `afio' will successfully back up FIFOs, but will
not correctly restore them. The problem arises from `afio' using mknod(2)
to try to create a FIFO - a Linuxism. The correct function for it to use
is mkfifo(2).

Also, `afio' tries to recreate sockets. This behavior should be disabled
under FreeBSD.

Fix: Put this patch in /usr/ports/sysutils/afio/files/patch-ad:
-------[snip]--


Remake the port, and the problem is fixed.

$ mkfifo testfifo
$ echo testfifo | afio -ov testfifo.afio
testfifo -- okay
$ rm testfifo
$ afio -iv testfifo.afio
testfifo -- okay
$ echo $?
0
$ ls -l testfifo
prw-r--r--  1 oremanj oremanj  0 May 19 18:35 testfifo|--HZeemUxQRzAnF5KAt4RKZ8aG2EPZ8tdpdhtFeoLQIqi9G4lh
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- afio.c.orig Mon May 19 18:11:57 2003
+++ afio.c      Mon May 19 18:24:07 2003
@@ -2953,14 +2953,14 @@
        if (perm != operm && chmod (name, perm) < 0)
          return (warn (name, syserr ()));
        else { ; }
-      else if (mknod (name, asb->sb_mode, (dev_t) 0) < 0
+      else if (mkfifo (name, asb->sb_mode) < 0
               && (errno != ENOENT
                   || dirneed (name) < 0
-                  || mknod (name, asb->sb_mode, (dev_t) 0) < 0))
+                  || mkfifo (name, asb->sb_mode) < 0))
        return (warn (name, syserr ()));
       break;
 #endif /* S_IFIFO */
-#ifdef S_IFSOCK
+#ifdef S_IFSOCK && !defined (__FreeBSD__)
     case S_IFSOCK:
       fd = 0;
       if (exists)
-------[snip]--
How-To-Repeat: $ mkfifo testfifo
$ echo testfifo | afio -ov testfifo.afio
testfifo -- okay
$ rm testfifo
$ afio -iv testfifo.afio
afio: testfifo: Invalid argument
testfifo -- okay
$ echo $?
1
$ ls -l testfifo
ls: testfifo: No such file or directory
Comment 1 Edwin Groothuis freebsd_committer 2003-09-30 00:20:06 UTC
Hello Juergen,

Could you please have a look at this PR and approve it?
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/52452

Edwin

-- 
Edwin Groothuis
edwin@freebsd.org
http://www.mavetju.org
Comment 2 Edwin Groothuis freebsd_committer 2003-09-30 00:36:24 UTC
State Changed
From-To: open->closed

Commited, thanks!