OBS User unknown 2009-02-19 16:32:46 +00:00 committed by Git OBS Bridge
parent ce93f35b0b
commit fb817d5c77
11 changed files with 499 additions and 149 deletions

View File

@ -0,0 +1,47 @@
From 1c666c65d5a33b17d57e7022fddf7b74d2ca1809 Mon Sep 17 00:00:00 2001
From: Eric Sandeen <sandeen@sandeen.net>
Date: Mon, 9 Feb 2009 00:59:00 +0100
Subject: [PATCH] acl: Return error status on setfacl failures
Resolves Red Hat bug:
rh#368451 - setfacl returns 0 even though it fails
From: Jiri Moskovcak <jmoskovc@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
---
setfacl/setfacl.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/setfacl/setfacl.c b/setfacl/setfacl.c
index 96f6fc4..240a9b5 100644
--- a/setfacl/setfacl.c
+++ b/setfacl/setfacl.c
@@ -137,7 +137,7 @@ restore(
if (error < 0)
goto fail;
if (error == 0)
- return 0;
+ return status;
if (path_p == NULL) {
if (filename) {
@@ -151,6 +151,7 @@ restore(
"aborting\n"),
progname, backup_line);
}
+ status = 1;
goto getout;
}
@@ -169,6 +170,7 @@ restore(
fprintf(stderr, _("%s: %s: %s in line %d\n"),
progname, xquote(filename), strerror(errno),
line);
+ status = 1;
goto getout;
}
--
1.6.0.2

View File

@ -1,3 +1,4 @@
From: Brandon Philips <bphilips@suse.de>
Subject: [PATH] acl: add getfacl -R -L -P tests
Test fixes to walk_tree.c by Andreas.

View File

@ -1,48 +1,49 @@
Subject: [PATCH] acl: add make test target and use make to run tests
From: Brandon Philips <bphilips@suse.de>
Subject: [PATCH] acl: add make tests target and use make to run tests
The tests are difficult to run. So, this patch adds a Make target that
sets up the path and runs *.test files in the test/ directory.
nfs specific tests can be ran from the test directory by running
`make nfs`
`make nfs-tests`
tests requiring root can be ran from the test directory by running
`make nfs`
`make root-tests`
Signed-off-by: Brandon Philips <bphilips@suse.de>
---
Makefile | 6 +++++-
test/Makefile | 26 +++++++++++++++++++-------
2 files changed, 24 insertions(+), 8 deletions(-)
Makefile | 4 ++++
test/Makefile | 27 ++++++++++++++++++++++++---
2 files changed, 28 insertions(+), 3 deletions(-)
Index: acl-2.2.47/test/Makefile
===================================================================
--- acl-2.2.47.orig/test/Makefile
+++ acl-2.2.47/test/Makefile
@@ -2,13 +2,25 @@
# Copyright (c) 2001-2002 Silicon Graphics, Inc. All Rights Reserved.
#
-TOPDIR = ..
-include $(TOPDIR)/include/builddefs
+TEST = $(wildcard *.test)
+ROOT = $(wildcard root/*.test)
+NFS = $(wildcard nfs/*.test)
@@ -5,10 +5,31 @@
TOPDIR = ..
include $(TOPDIR)/include/builddefs
-LSRCFILES = run make-tree \
- cp.test getfacl-noacl.test misc.test nfs-dir.test \
- nfsacl.test permissions.test setfacl.test
+PATH := $(abspath ../getfacl/):$(abspath ../setfacl/):$(abspath ../chacl/):$(PATH)
+TESTS = $(wildcard *.test)
+ROOT = $(wildcard root/*.test)
+NFS = $(wildcard nfs/*.test)
+LSRCFILES = run make-tree $(TESTS) $(ROOT) $(NFS)
-include $(BUILDRULES)
+all: $(TEST)
+root: $(ROOT)
+nfs: $(NFS)
include $(BUILDRULES)
-default install install-dev install-lib:
default install install-dev install-lib:
+
+$(TEST):
+PATH := $(abspath ../getfacl/):$(abspath ../setfacl/):$(abspath ../chacl/):$(PATH)
+
+tests: $(TESTS)
+root-tests: $(ROOT)
+nfs-tests: $(NFS)
+
+$(TESTS):
+ @echo "*** $@ ***"; perl run $@
+
+$(NFS):
@ -51,26 +52,19 @@ Index: acl-2.2.47/test/Makefile
+$(ROOT):
+ @echo "Note: Tests must run as root"; @echo "*** $@ ***"; perl run $@
+
+.PHONY: $(TEST) $(ROOT) $(NFS) default
+.PHONY: $(TESTS) $(NFS) $(ROOT)
+.NOTPARALLEL:
+
+
Index: acl-2.2.47/Makefile
===================================================================
--- acl-2.2.47.orig/Makefile
+++ acl-2.2.47/Makefile
@@ -17,7 +17,7 @@ LDIRT = config.log .dep config.status co
Logs/* built .census install.* install-dev.* install-lib.* *.gz
SUBDIRS = include libmisc libacl getfacl setfacl chacl m4 man doc po \
- test examples build debian
+ examples build debian
default: $(CONFIGURE)
ifeq ($(HAVE_BUILDDEFS), no)
@@ -65,3 +65,7 @@ install-lib: default
realclean distclean: clean
rm -f $(LDIRT) $(CONFIGURE)
rm -rf autom4te.cache Logs
+
+.PHONY: test
+test: default
+ $(MAKE) -C test/
+.PHONY: tests
+tests: default
+ $(MAKE) -C test/ tests

View File

@ -0,0 +1,182 @@
From: Eric Sandeen <sandeen@sandeen.net>
Date: Mon, 9 Feb 2009 00:50:51 +0100
Subject: [PATCH] acl: add short option support to the acl commands
Resolves Red Hat bugs:
rh#204087 - getfacl/setfacl should support -n
rh#457244 - setfacl does not recognize -v and -h
Folds in [PATCH] Manpage documents -r instead of -t now
From: Jiri Moskovcak <jmoskovc@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
---
getfacl/getfacl.c | 22 +++++++++++-----------
man/man1/getfacl.1 | 25 ++++++++++++++-----------
man/man1/setfacl.1 | 4 ++--
setfacl/setfacl.c | 8 ++++----
4 files changed, 31 insertions(+), 28 deletions(-)
Index: acl-2.2.47/getfacl/getfacl.c
===================================================================
--- acl-2.2.47.orig/getfacl/getfacl.c
+++ acl-2.2.47/getfacl/getfacl.c
@@ -43,7 +43,7 @@
#define POSIXLY_CORRECT_STR "POSIXLY_CORRECT"
#if !POSIXLY_CORRECT
-# define CMD_LINE_OPTIONS "dRLP"
+# define CMD_LINE_OPTIONS "aceEsRLPtpndvh"
#endif
#define POSIXLY_CMD_LINE_OPTIONS "d"
@@ -555,23 +555,23 @@ void help(void)
#if !POSIXLY_CORRECT
} else {
printf(_(
-" --access display the file access control list only\n"
+" -a, --access display the file access control list only\n"
" -d, --default display the default access control list only\n"
-" --omit-header do not display the comment header\n"
-" --all-effective print all effective rights\n"
-" --no-effective print no effective rights\n"
-" --skip-base skip files that only have the base entries\n"
+" -c, --omit-header do not display the comment header\n"
+" -e, --all-effective print all effective rights\n"
+" -E, --no-effective print no effective rights\n"
+" -s, --skip-base skip files that only have the base entries\n"
" -R, --recursive recurse into subdirectories\n"
" -L, --logical logical walk, follow symbolic links\n"
" -P, --physical physical walk, do not follow symbolic links\n"
-" --tabular use tabular output format\n"
-" --numeric print numeric user/group identifiers\n"
-" --absolute-names don't strip leading '/' in pathnames\n"));
+" -t, --tabular use tabular output format\n"
+" -n, --numeric print numeric user/group identifiers\n"
+" -p, --absolute-names don't strip leading '/' in pathnames\n"));
}
#endif
printf(_(
-" --version print version and exit\n"
-" --help this help text\n"));
+" -v, --version print version and exit\n"
+" -h, --help this help text\n"));
}
int main(int argc, char *argv[])
Index: acl-2.2.47/man/man1/getfacl.1
===================================================================
--- acl-2.2.47.orig/man/man1/getfacl.1
+++ acl-2.2.47/man/man1/getfacl.1
@@ -12,10 +12,10 @@ getfacl \- get file access control lists
.SH SYNOPSIS
.B getfacl
-[\-dRLPvh] file ...
+[\-aceEsRLPtpndvh] file ...
.B getfacl
-[\-dRLPvh] \-
+[\-aceEsRLPtpndvh] \-
.SH DESCRIPTION
For each file, getfacl displays the file name, owner, the group,
@@ -78,22 +78,22 @@ accessing the file mode.
.SS OPTIONS
.TP 4
-.I \-\-access
+.I \-a, \-\-access
Display the file access control list.
.TP
.I \-d, \-\-default
Display the default access control list.
.TP
-.I \-\-omit-header
+.I \-c, \-\-omit-header
Do not display the comment header (the first three lines of each file's output).
.TP
-.I \-\-all-effective
+.I \-e, \-\-all-effective
Print all effective rights comments, even if identical to the rights defined by the ACL entry.
.TP
-.I \-\-no-effective
+.I \-E, \-\-no-effective
Do not print effective rights comments.
.TP
-.I \-\-skip-base
+.I \-s, \-\-skip-base
Skip files that only have the base ACL entries (owner, group, others).
.TP
.I \-R, \-\-recursive
@@ -109,17 +109,20 @@ Physical walk, do not follow symbolic li
link arguments.
Only effective in combination with \-R.
.TP
-.I \-\-tabular
+.I \-t, \-\-tabular
Use an alternative tabular output format. The ACL and the default ACL are displayed side by side. Permissions that are ineffective due to the ACL mask entry are displayed capitalized. The entry tag names for the ACL_USER_OBJ and ACL_GROUP_OBJ entries are also displayed in capital letters, which helps in spotting those entries.
.TP
-.I \-\-absolute-names
+.I \-p, \-\-absolute-names
Do not strip leading slash characters (`/'). The default behavior is to
strip leading slash characters.
.TP
-.I \-\-version
+.I \-n, \-\-numeric
+List numeric user and group IDs
+.TP
+.I \-v, \-\-version
Print the version of getfacl and exit.
.TP
-.I \-\-help
+.I \-h, \-\-help
Print help explaining the command line options.
.TP
.I \-\-
Index: acl-2.2.47/man/man1/setfacl.1
===================================================================
--- acl-2.2.47.orig/man/man1/setfacl.1
+++ acl-2.2.47/man/man1/setfacl.1
@@ -115,10 +115,10 @@ This also skips symbolic link arguments.
Only effective in combination with \-R.
This option cannot be mixed with `\-\-restore'.
.TP 4
-.I \-\-version
+.I \-v, \-\-version
Print the version of setfacl and exit.
.TP 4
-.I \-\-help
+.I \-h, \-\-help
Print help explaining the command line options.
.TP 4
.I \-\-
Index: acl-2.2.47/setfacl/setfacl.c
===================================================================
--- acl-2.2.47.orig/setfacl/setfacl.c
+++ acl-2.2.47/setfacl/setfacl.c
@@ -42,10 +42,10 @@ extern int do_set(const char *path_p, co
/* '-' stands for `process non-option arguments in loop' */
#if !POSIXLY_CORRECT
-# define CMD_LINE_OPTIONS "-:bkndm:M:x:X:RLP"
+# define CMD_LINE_OPTIONS "-:bkndvhm:M:x:X:RLP"
# define CMD_LINE_SPEC "[-bkndRLP] { -m|-M|-x|-X ... } file ..."
#endif
-#define POSIXLY_CMD_LINE_OPTIONS "-:bkndm:M:x:X:"
+#define POSIXLY_CMD_LINE_OPTIONS "-:bkndvhm:M:x:X:"
#define POSIXLY_CMD_LINE_SPEC "[-bknd] {-m|-M|-x|-X ... } file ..."
struct option long_options[] = {
@@ -265,8 +265,8 @@ void help(void)
}
#endif
printf(_(
-" --version print version and exit\n"
-" --help this help text\n"));
+" -v, --version print version and exit\n"
+" -h, --help this help text\n"));
}

View File

@ -0,0 +1,63 @@
From: Eric Sandeen <sandeen@sandeen.net>
Date: Mon, 9 Feb 2009 01:02:38 +0100
Subject: [PATCH] acl: fix setfacl for long utf8 filenames
Resolved Red Hat bugs:
rh#183181 - Bad: utf8 long filenames - invalid argument
rh#287701 - PATH_MAX patch seems incomplete
From: Andrey <afletdinov@dc.baikal.ru>
From: Thomas Woerner <twoerner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Acked-by: Brandon Philips <bphilips@suse.de>
---
setfacl/parse.c | 8 +++++++-
test/utf8-filenames.test | 14 ++++++++++++++
2 files changed, 21 insertions(+), 1 deletion(-)
Index: acl-2.2.47/setfacl/parse.c
===================================================================
--- acl-2.2.47.orig/setfacl/parse.c
+++ acl-2.2.47/setfacl/parse.c
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
+#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -412,7 +413,12 @@ read_acl_comments(
gid_t *gid_p)
{
int c;
- char linebuf[1024];
+ /*
+ Max PATH_MAX bytes even for UTF-8 path names and additional 9
+ bytes for "# file: ". Not a good solution but for now it is the
+ best I can do without too much impact on the code. [tw]
+ */
+ char linebuf[(4*PATH_MAX)+9];
char *cp;
char *p;
int comments_read = 0;
Index: acl-2.2.47/test/utf8-filenames.test
===================================================================
--- /dev/null
+++ acl-2.2.47/test/utf8-filenames.test
@@ -0,0 +1,14 @@
++Test the setfacl --restore with utf8 paths.
++Regression test: https://bugzilla.redhat.com/show_bug.cgi?id=183181
+
+The utf string UPATH is 250 bytes long and is repeated 4 times to create the
+path that setfacl will use. This size should work on systems with a small 255
+NAME_MAX.
+
+ $ export UPATH="官官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話官話話官話官話官話>官話官話話官話官"
+ $ mkdir -p $UPATH/$UPATH/$UPATH
+ $ touch $UPATH/$UPATH/$UPATH/$UPATH
+ $ getfacl $UPATH/$UPATH/$UPATH/$UPATH > utf8-filenames.acl
+ $ setfacl --restore=utf8-filenames.acl
+ $ rm -R $UPATH
+ $ rm utf8-filenames.acl

View File

@ -1,3 +1,4 @@
From: Brandon Philips <bphilips@suse.de>
Subject: [PATCH] acl: minor fix to cp.test
X -> x

View File

@ -1,3 +1,4 @@
From: Brandon Philips <bphilips@suse.de>
Subject: [PATCH] acl: move nfs tests to their own folder
Since these tests require nfs mounts to run move them into a seperate

View File

@ -1,3 +1,4 @@
From: Brandon Philips <bphilips@suse.de>
Subject: [PATCH] acl: move root tests to their own folder
Since these tests require root perms to run move them into a seperate
@ -483,7 +484,7 @@ Index: acl-2.2.47/test/root/permissions.test
+
+ $ su daemon
+ $ echo daemon >> f
+ | f: Permission denied$
+ >~ .*f: Permission denied$
+
+ $ su
+
@ -507,7 +508,7 @@ Index: acl-2.2.47/test/root/permissions.test
+ > bin
+
+ $ echo daemon >> f
+ | f: Permission denied$
+ >~ .*f: Permission denied$
+
+
+Now, add an ACL entry for user daemon that grants him rw- access. File
@ -549,7 +550,7 @@ Index: acl-2.2.47/test/root/permissions.test
+
+ $ su daemon
+ $ echo daemon >> f
+ | f: Permission denied$
+ >~ .*f: Permission denied$
+
+
+Add an entry for group daemon with rw- access, and change the
@ -562,7 +563,7 @@ Index: acl-2.2.47/test/root/permissions.test
+
+ $ su daemon
+ $ echo daemon >> f
+ | f: Permission denied$
+ >~ .*f: Permission denied$
+
+
+Remove the entry for user daemon. The group daemon permissions should
@ -588,7 +589,7 @@ Index: acl-2.2.47/test/root/permissions.test
+
+ $ su daemon
+ $ echo daemon3 >> f
+ | f: Permission denied$
+ >~ .*f: Permission denied$
+
+
+Now, remove the group daemon entry. Because user daemon is a member in
@ -599,7 +600,7 @@ Index: acl-2.2.47/test/root/permissions.test
+
+ $ su daemon
+ $ echo daemon4 >> f
+ | f: Permission denied$
+ >~ .*f: Permission denied$
+
+
+Change the owning group. The other permissions should now grant user
@ -625,10 +626,10 @@ Index: acl-2.2.47/test/root/permissions.test
+ $ setfacl -m g:bin:r,g:daemon:w f
+
+ $ su daemon
+ $ : < f # open for reading
+ $ : > f # open for writing
+ $ : <> f # open for read-write
+ | f: Permission denied$
+ $ : < f
+ $ : > f
+ $ : <> f
+ >~ .*f: Permission denied$
+
+
+Test if directories can have ACLs. We assume that only one access check
@ -644,7 +645,7 @@ Index: acl-2.2.47/test/root/permissions.test
+ >
+
+ $ echo i > e/i
+ | e/i: Permission denied$
+ >~ .*e/i: Permission denied$
+
+ $ su
+ $ setfacl -m u:bin:rx e
@ -653,7 +654,7 @@ Index: acl-2.2.47/test/root/permissions.test
+ $ echo e/*
+ > e/h
+ $ echo i > e/i
+ | e/i: Permission denied$
+ >~ .*e/i: Permission denied$
+
+ $ su
+ $ setfacl -m u:bin:rwx e
@ -678,24 +679,24 @@ Index: acl-2.2.47/test/root/permissions.test
+test if the device exists.
+
+
+ $ mknod -m 0660 hdt b 91 64 # /dev/hdt
+ $ mknod -m 0660 null c 1 3 # /dev/null
+ $ mknod -m 0660 hdt b 91 64
+ $ mknod -m 0660 null c 1 3
+ $ mkfifo -m 0660 fifo
+
+ $ su bin
+ $ : < hdt
+ | hdt: Permission denied$
+ >~ .*hdt: Permission denied$
+ $ : < null
+ | null: Permission denied$
+ >~ .*null: Permission denied$
+ $ : < fifo
+ | fifo: Permission denied$
+ >~ .*fifo: Permission denied$
+
+ $ su
+ $ setfacl -m u:bin:rw hdt null fifo
+
+ $ su bin
+ $ : < hdt
+ | hdt: No such device or address$
+ >~ .*hdt: No such device or address$
+ $ : < null
+ $ ( echo blah > fifo & ) ; cat fifo
+ > blah

View File

@ -1,6 +1,9 @@
From: Andreas Gruenbacher <agruen@suse.de>
Subject: [PATCH] acl: various improvements for test/run
First move process_test to avoid a warning:
Update the run script with various improvements:
Avoid a warning:
main::process_test() called too early to check prototype at ./run line 47.
main::process_test() called too early to check prototype at ./run line 60.
@ -8,20 +11,71 @@ main::process_test() called too early to check prototype at ./run line 60.
Create two ENV variables TUSER and TGROUP to get the user/group
running the test.
Add a | test line that is similar to > but is interpreted as a regular
Add a >~ test line that is similar to > but is interpreted as a regular
expression.
Signed-off-by: Brandon Philips <bphilips@suse.de>
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
---
test/run | 99 ++++++++++++++++++++++++++++++++-------------------------------
1 file changed, 51 insertions(+), 48 deletions(-)
test/run | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 72 insertions(+), 18 deletions(-)
Index: acl-2.2.47/test/run
===================================================================
--- acl-2.2.47.orig/test/run
+++ acl-2.2.47/test/run
@@ -25,26 +25,69 @@ if (isatty(fileno(STDOUT))) {
@@ -1,5 +1,32 @@
#!/usr/bin/perl -w -U
+# Copyright (c) 2007, 2008 Andreas Gruenbacher.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions, and the following disclaimer,
+# without modification, immediately at the beginning of the file.
+# 2. The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# Alternatively, this software may be distributed under the terms of the
+# GNU Public License ("GPL").
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
#
# Possible improvements:
#
@@ -12,12 +39,13 @@
use strict;
use FileHandle;
use Getopt::Std;
-use POSIX qw(isatty setuid);
-use vars qw($opt_v);
+use POSIX qw(isatty setuid getcwd);
+use vars qw($opt_l $opt_v);
no warnings qw(taint);
-getopts('v');
+$opt_l = ~0; # a really huge number
+getopts('l:v');
my ($OK, $FAILED) = ("ok", "failed");
if (isatty(fileno(STDOUT))) {
@@ -25,18 +53,24 @@ if (isatty(fileno(STDOUT))) {
$FAILED = "\033[31m\033[1m" . $FAILED . "\033[m";
}
@ -29,121 +83,110 @@ Index: acl-2.2.47/test/run
+$ENV{"TGROUP"} = getgrgid($));
+
sub exec_test($$);
+sub process_test($$$$);
-my ($prog, $in, $out) = ([], [], []);
+my ($prog, $in, $out, $outmatch) = ([], [], [], []);
my $line_number = 0;
my $prog_line;
my ($prog, $in, $out) = ([], [], []);
-my $line_number = 0;
-my $prog_line;
+my $prog_line = 0;
my ($tests, $failed) = (0,0);
+my $lineno;
+my $width = ($ENV{COLUMNS} || 80) >> 1;
+sub process_test($$$$$) {
+ my ($prog, $prog_line, $in, $out, $outmatch) = @_;
+
+ return unless @$prog;
+
+ my $p = [ @$prog ];
+ print "[$prog_line] \$ ", join(' ',
+ map { s/\s/\\$&/g; $_ } @$p), " -- ";
+ my $result = exec_test($prog, $in);
+ my $good = 1;
+ my $nmax = (@$outmatch > @$result) ? @$outmatch : @$result;
+ for (my $n=0; $n < $nmax; $n++) {
+ if (!defined($outmatch->[$n]) || !defined($result->[$n]) ||
+ $result->[$n] !~ /($outmatch->[$n])/) {
+ $good = 0;
+ }
+ }
+ $tests++;
+ $failed++ unless $good;
+ print $good ? $OK : $FAILED, "\n";
+ if (!$good) {
+ for (my $n=0; $n < $nmax; $n++) {
+ my $l = defined($out->[$n]) ? $out->[$n] : "~";
+ chomp $l;
+ my $r = defined($result->[$n]) ? $result->[$n] : "~";
+ chomp $r;
+ print sprintf("%-37s %s %-39s\n", $l, $l eq $r ? "|" : "?", $r);
+ }
+ } elsif ($opt_v) {
+ print join('', @$result);
+ }
+}
+
+
+
for (;;) {
my $line = <>; $line_number++;
- my $line = <>; $line_number++;
+ my $line = <>; $lineno++;
if (defined $line) {
# Substitute %VAR and %{VAR} with environment variables.
- $line =~ s[%(?:(\w+)|\{(\w+)\})][$ENV{"$1$2"}]eg;
+ $line =~ s[%\{(\w+)\}][$ENV{"$1"}]eg;
+ $line =~ s[%(\w+)][$ENV{"$1"}]eg;
+ $line =~ s[%(\w+)][$ENV{$1}]eg;
+ $line =~ s[%{(\w+)}][$ENV{$1}]eg;
}
if (defined $line) {
if ($line =~ s/^\s*< ?//) {
push @$in, $line;
- } elsif ($line =~ s/^\s*> ?//) {
+ } elsif ($line =~ s/^\s*> ?//) { # explicit matching
+ push @$outmatch, "^(\Q$line\E)\$";
+ push @$out, $line;
+ } elsif ($line =~ s/^\s*\| ?//) { # regex case
+ push @$outmatch, $line;
@@ -45,14 +79,14 @@ for (;;) {
push @$out, $line;
} else {
- process_test($prog, $prog_line, $in, $out);
+ process_test($prog, $prog_line, $in, $out, $outmatch);
process_test($prog, $prog_line, $in, $out);
+ last if $prog_line >= $opt_l;
$prog = [];
$prog_line = 0;
@@ -55,9 +98,10 @@ for (;;) {
$prog_line = $line_number;
}
if ($line =~ s/^\s*\$ ?//) {
- $line =~ s/\s+#.*//; # remove comments here...
$prog = [ map { s/\\(.)/$1/g; $_ } split /(?<!\\)\s+/, $line ];
- $prog_line = $line_number;
+ $prog_line = $lineno;
$in = [];
$out = [];
+ $outmatch = [];
}
} else {
- process_test($prog, $prog_line, $in, $out);
+ process_test($prog, $prog_line, $in, $out, $outmatch);
last;
}
}
@@ -75,39 +119,6 @@ print $status, "\n";
exit $failed ? 1 : 0;
-sub process_test($$$$) {
- my ($prog, $prog_line, $in, $out) = @_;
-
- return unless @$prog;
-
- my $p = [ @$prog ];
- print "[$prog_line] \$ ", join(' ',
- map { s/\s/\\$&/g; $_ } @$p), " -- ";
- my $result = exec_test($prog, $in);
@@ -84,27 +118,37 @@ sub process_test($$$$) {
print "[$prog_line] \$ ", join(' ',
map { s/\s/\\$&/g; $_ } @$p), " -- ";
my $result = exec_test($prog, $in);
- my $good = 1;
- my $nmax = (@$out > @$result) ? @$out : @$result;
- for (my $n=0; $n < $nmax; $n++) {
+ my @good = ();
my $nmax = (@$out > @$result) ? @$out : @$result;
for (my $n=0; $n < $nmax; $n++) {
- if (!defined($out->[$n]) || !defined($result->[$n]) ||
- $out->[$n] ne $result->[$n]) {
- $good = 0;
- }
- }
- $tests++;
- $failed++ unless $good;
- print $good ? $OK : $FAILED, "\n";
+ my $use_re;
+ if (defined $out->[$n] && $out->[$n] =~ /^~ /) {
+ $use_re = 1;
+ $out->[$n] =~ s/^~ //g;
+ }
+
+ if (!defined($out->[$n]) || !defined($result->[$n]) ||
+ (!$use_re && $result->[$n] ne $out->[$n]) ||
+ ( $use_re && $result->[$n] !~ /^$out->[$n]/)) {
+ push @good, ($use_re ? '!~' : '!=');
+ }
+ else {
+ push @good, ($use_re ? '=~' : '==');
+ }
}
+ my $good = !(grep /!/, @good);
$tests++;
$failed++ unless $good;
print $good ? $OK : $FAILED, "\n";
- if (!$good) {
- for (my $n=0; $n < $nmax; $n++) {
- my $l = defined($out->[$n]) ? $out->[$n] : "~";
- chomp $l;
- my $r = defined($result->[$n]) ? $result->[$n] : "~";
- chomp $r;
+ if (!$good || $opt_v) {
for (my $n=0; $n < $nmax; $n++) {
my $l = defined($out->[$n]) ? $out->[$n] : "~";
chomp $l;
my $r = defined($result->[$n]) ? $result->[$n] : "~";
chomp $r;
- print sprintf("%-37s %s %-39s\n", $l, $l eq $r ? "|" : "?", $r);
- }
+ print sprintf("%-" . ($width-3) . "s %s %s\n",
+ $r, $good[$n], $l);
}
- } elsif ($opt_v) {
- print join('', @$result);
- }
-}
-
}
}
sub su($) {
my ($user) = @_;
@@ -191,11 +235,21 @@ sub exec_test($$) {
if (!chdir $prog->[1]) {
return [ "chdir: $prog->[1]: $!\n" ];
}
+ $ENV{PWD} = getcwd;
return [];
} elsif ($prog->[0] eq "su") {
return su($prog->[1]);
} elsif ($prog->[0] eq "sg") {
return sg($prog->[1]);
+ } elsif ($prog->[0] eq "export") {
+ my ($name, $value) = split /=/, $prog->[1];
+ # FIXME: need to evaluate $value, so that things like this will work:
+ # export dir=$PWD/dir
+ $ENV{$name} = $value;
+ return [];
+ } elsif ($prog->[0] eq "unset") {
+ delete $ENV{$prog->[1]};
+ return [];
}
pipe *IN2, *OUT

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Feb 12 23:11:42 PST 2009 - bphilips@novell.com
- fix setfacl for long utf8 filenames (rh#183181)
- Return error status on setfacl failures (rh#368451)
- getfacl/setfacl should support shortcode flags (rh#204087)
-------------------------------------------------------------------
Thu Jan 8 13:16:22 PST 2009 - bphilips@novell.com

View File

@ -24,7 +24,7 @@ Group: System/Filesystems
AutoReqProv: on
Summary: Commands for Manipulating POSIX Access Control Lists
Version: 2.2.47
Release: 28
Release: 31
Source: %name-%version.src.tar.bz2
Patch0: builddefs.in.diff
Patch1: walk-tree-fix-for-deref.patch
@ -35,6 +35,9 @@ Patch5: acl-move-root-tests-to-their-own-folder.patch
Patch6: acl-move-nfs-tests-to-their-own-folder.patch
Patch7: acl-minor-fix-to-cp.test.patch
Patch8: acl-add-getfacl-r-l-p-tests.patch
Patch9: acl-fix-setfacl-for-long-utf8-filenames.patch
Patch10: acl-Return-error-status-on-setfacl-failures.patch
Patch11: acl-add-short-option-support-to-the-acl-commands.patch
Url: ftp://oss.sgi.com/projects/xfs/cmd_tars
License: GPL v2 or later
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -107,6 +110,9 @@ Authors:
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%build
export OPTIMIZER="$RPM_OPT_FLAGS -fPIC"
@ -214,6 +220,10 @@ rm -f $RPM_BUILD_ROOT/%{_lib}/libacl.{a,la,so}
/%{_lib}/libacl.so.1*
%changelog
* Thu Feb 12 2009 bphilips@novell.com
- fix setfacl for long utf8 filenames (rh#183181)
- Return error status on setfacl failures (rh#368451)
- getfacl/setfacl should support shortcode flags (rh#204087)
* Thu Jan 08 2009 bphilips@novell.com
- Added a number of unit test improvements
* Wed Dec 10 2008 olh@suse.de