Date: 20 May 2003 01:40:46 -0000 From: Joshua Oreman <oremanj@www.get-linux.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/52452: [PATCH] sysutils/afio mangles FIFOs Message-ID: <20030520014046.65037.qmail@adsl-64-161-78-226.dsl.lsan03.pacbell.net> Resent-Message-ID: <200305200140.h4K1eBhb011591@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 52452 >Category: ports >Synopsis: [PATCH] sysutils/afio mangles FIFOs >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon May 19 18:40:10 PDT 2003 >Closed-Date: >Last-Modified: >Originator: oremanj >Release: FreeBSD 5.0-CURRENT i386 >Organization: home >Environment: System: FreeBSD webserver.get-linux.org 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Wed May 7 17:32:53 PDT 2003 root@webserver.get-linux.org:/usr/obj/usr/src/sys/GENERIC i386 >Description: 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. >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 >Fix: Put this patch in /usr/ports/sysutils/afio/files/patch-ad: -------[snip]-- --- 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]-- 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| >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030520014046.65037.qmail>