Subject: standards/8027: link(1) and unlink(1) commands missing
To: None <gnats-bugs@gnats.netbsd.org>
From: Giles Lean <giles@nemeton.com.au>
List: netbsd-bugs
Date: 07/18/1999 17:21:21
>Number:         8027
>Category:       standards
>Synopsis:       link(1) and unlink(1) commands missing
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    standards-manager (NetBSD Standards Conformance bug manager)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 18 16:35:00 1999
>Last-Modified:
>Originator:     Giles Lean
>Organization:
>Release:        -current as of July 19, 1999
>Environment:
	
System: NetBSD nemeton.com.au 1.4_ALPHA NetBSD 1.4_ALPHA (NEMETON) #0: Wed Apr 21 08:26:27 EST 1999 giles@nemeton.com.au:/a/build/sys/arch/i386/compile/NEMETON i386


>Description:
	The link(1) and unlink(1) commands specified by UNIX98 aka
	"The Single Unix Specification, version 2" do not exist.

	Note: the lack was noticed during discussion of the inability
	to link directories on NetBSD.  The addition of these commands
	does nothing to change that situation; the restriction is
	implmented in the filesystem, not in ln(1).
>How-To-Repeat:
	$ man link
	$ man unlink
>Fix:
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	link
#	link/Makefile
#	link/link.1
#	link/link.c
#	unlink
#	unlink/Makefile
#	unlink/unlink.1
#	unlink/unlink.c
#
echo c - link
mkdir -p link > /dev/null 2>&1
echo x - link/Makefile
sed 's/^X//' >link/Makefile << 'END-of-link/Makefile'
XPROG=	link
XMAN=	link.1
X
X.include <bsd.prog.mk>
END-of-link/Makefile
echo x - link/link.1
sed 's/^X//' >link/link.1 << 'END-of-link/link.1'
X.\"	$NetBSD$
X.\"
X.\" Copyright (c) 1999 Nemeton Pty Ltd (ACN 059 848 485).
X.\" All rights reserved.
X.\"
X.\" Redistribution and use in source and binary forms, with or without
X.\" modification, are permitted provided that the following conditions
X.\" are met:
X.\" 1. Redistributions of source code must retain the above copyright
X.\"    notice, this list of conditions and the following disclaimer.
X.\" 2. Redistributions in binary form must reproduce the above copyright
X.\"    notice, this list of conditions and the following disclaimer in the
X.\"    documentation and/or other materials provided with the distribution.
X.\" 3. Neither the name Nemeton Pty Ltd nor the names of the authors
X.\"    of this software may be used to endorse or promote products derived
X.\"    from this software without specific prior written permission.
X.\"
X.\" THIS SOFTWARE IS PROVIDED BY NEMETON PTY LTD ``AS IS'' AND ANY
X.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
X.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL NEMETON PTY LTD BE LIABLE
X.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
X.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
X.\" OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
X.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
X.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
X.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
X.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
X.\"
X.Dd July 19, 1999
X.Dt LINK 1
X.Os
X.Sh NAME
X.Nm link
X.Nd "call the link() system call"
X.Sh SYNOPSIS
X.Nm
X.Ar path1
X.Ar path2
X.Sh DESCRIPTION
XThe
X.Nm
Xcommand calls the system call
X.Fa "link(path1, path2)"
Xwithout validation, interpretation or translation of path1 or path2.
X.Pp
XCreating links to directories may
Xdepend on whether the caller has sufficient privilege and whether the
Xoperating system and filesystem support such an operation.
X.Sh DIAGNOSTICS
XThe
X.Nm
Xutility exits 0 on success and non-zero on failure.
XIf an error occurs the system error
Xmessage corresponding to the error returned from the
X.Fa "link()"
Xcall will be displayed.
X.Sh SEE ALSO
X.Xr ln 1 ,
X.Xr link 2 ,
X.Xr unlink 1
X.Sh STANDARDS
X.\" Also conforms to SVID2, SVID3 and probably SVID4: care factor zero.
XThe
X.Nm
Xutility conforms to
X.\" REVISIT SVID2, SVID3
X.\" XXX this standard should have a standard macro defined for it
Xthe Single
X.Tn UNIX
XSpecification, version 2.
X.Sh AUTHOR
XGiles Lean, Nemeton Pty. Ltd.
END-of-link/link.1
echo x - link/link.c
sed 's/^X//' >link/link.c << 'END-of-link/link.c'
X/*
X * Copyright (c) 1999 Nemeton Pty Ltd (ACN 059 848 485).
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X *    notice, this list of conditions and the following disclaimer.
X * 2. Redistributions in binary form must reproduce the above copyright
X *    notice, this list of conditions and the following disclaimer in the
X *    documentation and/or other materials provided with the distribution.
X * 3. Neither the name Nemeton Pty Ltd nor the names of the authors
X *    of this software may be used to endorse or promote products derived
X *    from this software without specific prior written permission.
X *
X * THIS SOFTWARE IS PROVIDED BY NEMETON PTY LTD ``AS IS'' AND ANY
X * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
X * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL NEMETON PTY LTD BE LIABLE
X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
X * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
X * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
X * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
X * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
X * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
X * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
X */
X
X#include <sys/cdefs.h>
X
X#ifndef lint
X__RCSID("$NetBSD$");
X#endif
X
X#include <err.h>
X#include <stdio.h>
X#include <unistd.h>
X
Xint	main __P((int, char *[]));
Xvoid	usage __P((void));
X
Xint
Xmain(argc, argv)
X	int argc;
X	char *argv[];
X{
X	if (argc != 3) {
X		(void) fprintf(stderr, "usage: link path1 path2\n");
X		exit(1);
X	}
X	if (link(argv[1], argv[2]) == -1)
X		err(1, (char *) 0);
X	exit(0);
X	/* NOTREACHED */
X}
END-of-link/link.c
echo c - unlink
mkdir -p unlink > /dev/null 2>&1
echo x - unlink/Makefile
sed 's/^X//' >unlink/Makefile << 'END-of-unlink/Makefile'
XPROG=	unlink
XMAN=	unlink.1
X
X.include <bsd.prog.mk>
END-of-unlink/Makefile
echo x - unlink/unlink.1
sed 's/^X//' >unlink/unlink.1 << 'END-of-unlink/unlink.1'
X.\"	$NetBSD$
X.\"
X.\" Copyright (c) 1999 Nemeton Pty Ltd (ACN 059 848 485).
X.\" All rights reserved.
X.\"
X.\" Redistribution and use in source and binary forms, with or without
X.\" modification, are permitted provided that the following conditions
X.\" are met:
X.\" 1. Redistributions of source code must retain the above copyright
X.\"    notice, this list of conditions and the following disclaimer.
X.\" 2. Redistributions in binary form must reproduce the above copyright
X.\"    notice, this list of conditions and the following disclaimer in the
X.\"    documentation and/or other materials provided with the distribution.
X.\" 3. Neither the name Nemeton Pty Ltd nor the names of the authors
X.\"    of this software may be used to endorse or promote products derived
X.\"    from this software without specific prior written permission.
X.\"
X.\" THIS SOFTWARE IS PROVIDED BY NEMETON PTY LTD ``AS IS'' AND ANY
X.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
X.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL NEMETON PTY LTD BE LIABLE
X.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
X.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
X.\" OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
X.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
X.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
X.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
X.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
X.\"
X.Dd July 19, 1999
X.Dt UNLINK 1
X.Os
X.Sh NAME
X.Nm unlink
X.Nd "call the unlink() system call"
X.Sh SYNOPSIS
X.Nm
X.Ar pathname
X.Sh DESCRIPTION
XThe
X.Nm
Xcommand calls the system call
X.Fa "unlink(pathname)"
Xwithout validation, interpretation or translation of pathname.
X.Pp
XUnlinking of directories may depend
Xdepend on whether the caller has sufficient privilege and whether the
Xoperating system and filesystem support such an operation.
X.Sh DIAGNOSTICS
XThe
X.Nm
Xutility exits 0 on success and non-zero on failure.
XIf an error occurs the system error
Xmessage corresponding to the error returned from the
X.Fa "unlink()"
Xcall will be displayed.
X.Sh SEE ALSO
X.Xr ln 1 ,
X.Xr link 2
X.Sh STANDARDS
XThe
X.Nm
Xutility conforms to
X.\" XXX this standard should have a standard macro defined for it
Xthe Single
X.Tn UNIX
XSpecification, version 2.
X.Sh AUTHOR
XGiles Lean, Nemeton Pty. Ltd.
END-of-unlink/unlink.1
echo x - unlink/unlink.c
sed 's/^X//' >unlink/unlink.c << 'END-of-unlink/unlink.c'
X/*
X * Copyright (c) 1999 Nemeton Pty Ltd (ACN 059 848 485).
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X *    notice, this list of conditions and the following disclaimer.
X * 2. Redistributions in binary form must reproduce the above copyright
X *    notice, this list of conditions and the following disclaimer in the
X *    documentation and/or other materials provided with the distribution.
X * 3. Neither the name Nemeton Pty Ltd nor the names of the authors
X *    of this software may be used to endorse or promote products derived
X *    from this software without specific prior written permission.
X *
X * THIS SOFTWARE IS PROVIDED BY NEMETON PTY LTD ``AS IS'' AND ANY
X * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
X * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL NEMETON PTY LTD BE LIABLE
X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
X * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
X * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
X * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
X * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
X * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
X * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
X */
X
X#include <sys/cdefs.h>
X
X#ifndef lint
X__RCSID("$NetBSD$");
X#endif
X
X#include <err.h>
X#include <stdio.h>
X#include <unistd.h>
X
Xint	main __P((int, char *[]));
Xvoid	usage __P((void));
X
Xint
Xmain(argc, argv)
X	int argc;
X	char *argv[];
X{
X	if (argc != 2) {
X		(void) fprintf(stderr, "usage: link pathname\n");
X		exit(1);
X	}
X	if (unlink(argv[1]) == -1)
X		err(1, argv[1]);
X	exit(0);
X	/* NOTREACHED */
X}
END-of-unlink/unlink.c
exit

>Audit-Trail:
>Unformatted: