On Tue, Aug 30, 2011 at 01:25:14AM +0200, Rogier Krieger wrote:
> ...at present do not seem to go together nicely:
>
> # tail -n 1 /etc/fstab
> 73123067c3dc34d4.a /data ffs rw,userquota,groupquota 1 1
>
> # /sbin/quotacheck /data
> quotacheck: 73123067c3dc34d4.a: No such file or directory
>
>
> Would the attached diff be acceptable? It appears to solve my issue,
> working with both the /dev/sd0a and duid forms. Note that (for
> unchanged fstab and patch applied), using quotacheck with the
> then-current physical device (sd0a) complains.
> # /sbin/quotacheck /dev/sd0a
> /dev/sd0a not found in /etc/fstab
>
> Hardly surprising, since it's indeed not in fstab; I suppose it's
> overkill to add logic for this. In case the diff gets mangled in
> transit, alternatively try: http://pastebin.com/VRN8wZX6
>
> Regards,
>
> Rogier
I think that the logic to recognize '/dev/sd0a' as being in fstab
whether literally or as a DUID would be required. This would appear
to require moving the opendev() to above the getfsent() loop and
adding a check for "argnum = oneof(realpath, argv, argc)". And of
course moving the associated close().
Not using quotacheck I can't quickly determine if that works.
Checking for other consumers of getfsent() vs device name on
command line would be interesting.
.... Ken
>
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/src/sbin/quotacheck/Makefile,v
> retrieving revision 1.6
> diff -u -r1.6 Makefile
> --- Makefile 21 Sep 1997 11:37:57 -0000 1.6
> +++ Makefile 29 Aug 2011 23:20:47 -0000
> @@ -6,4 +6,7 @@
> MAN= quotacheck.8
> .PATH: ${.CURDIR}/../fsck
>
> +LDADD+=-lutil
> +DPADD+=${LIBUTIL}
> +
> .include <bsd.prog.mk>
> Index: quotacheck.c
> ===================================================================
> RCS file: /cvs/src/sbin/quotacheck/quotacheck.c,v
> retrieving revision 1.25
> diff -u -r1.25 quotacheck.c
> --- quotacheck.c 27 Oct 2009 23:59:34 -0000 1.25
> +++ quotacheck.c 29 Aug 2011 23:20:47 -0000
> @@ -50,6 +50,7 @@
> #include <grp.h>
> #include <errno.h>
> #include <unistd.h>
> +#include <util.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> @@ -263,13 +264,14 @@
> ino_t ino, inosused;
> pid_t pid;
> char *cp;
> + char *realdev;
>
> switch (pid = fork()) {
> case -1: /* error */
> warn("fork");
> return 1;
> case 0: /* child */
> - if ((fi = open(fsname, O_RDONLY, 0)) < 0)
> + if ((fi = opendev(fsname, O_RDONLY, 0, &realdev)) < 0)
> err(1, "%s", fsname);
> sync();
> dev_bsize = 1;