diff --git a/.gitignore b/.gitignore index e69de29..1985515 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/acl-2.2.*.tar.gz diff --git a/0001-acl-2.2.53-test-runwrapper.patch b/0001-acl-2.2.53-test-runwrapper.patch new file mode 100644 index 0000000..7c27c6c --- /dev/null +++ b/0001-acl-2.2.53-test-runwrapper.patch @@ -0,0 +1,44 @@ +From 085cc4ff56857d234e80f37d0316c13eb5718696 Mon Sep 17 00:00:00 2001 +From: Kamil Dudka +Date: Tue, 3 Jul 2018 10:46:58 +0200 +Subject: [PATCH] test/runwrapper: copy the preloaded library + +... to a temporary directory because the original location might +not be accessible by other users. +--- + test/runwrapper | 20 ++++++++++++++++++-- + 1 file changed, 18 insertions(+), 2 deletions(-) + +diff --git a/test/runwrapper b/test/runwrapper +index 6e0e899..de4555a 100755 +--- a/test/runwrapper ++++ b/test/runwrapper +@@ -1,7 +1,23 @@ + #!/bin/bash + +-if [ -e "$PWD/.libs/libtestlookup.so" ]; then +- export LD_PRELOAD="$PWD/.libs/libtestlookup.so" ++src="$PWD/.libs/libtestlookup.so" ++dst= ++if [ -e "$src" ]; then ++ # copy the preloaded library to a temporary directory because ++ # the original location might not be accessible by other users ++ tmp="$(mktemp -d)" ++ chmod 0755 "$tmp" ++ dst="${tmp}/libtestlookup.so" ++ cp -L "$src" "$dst" ++ export LD_PRELOAD="$dst" + fi + + "${srcdir:-${PWD}}"/test/run "$@" ++ec="$?" ++ ++if [ -n "$dst" ]; then ++ # remove the temporary location ++ rm -rf "$dst" ++fi ++ ++exit "$ec" +-- +2.14.4 + diff --git a/0002-acl-2.2.53-setattr-segv.patch b/0002-acl-2.2.53-setattr-segv.patch new file mode 100644 index 0000000..430838c --- /dev/null +++ b/0002-acl-2.2.53-setattr-segv.patch @@ -0,0 +1,29 @@ +From c03773259fbe6d3f3355efc8e66990718d5cab54 Mon Sep 17 00:00:00 2001 +From: Kamil Dudka +Date: Mon, 31 Aug 2020 17:16:34 +0200 +Subject: [PATCH] __acl_create_entry_obj: do not break strict aliasing rules + +... to avoid SIGSEGV with link-time optimisation enabled + +Bug: https://bugzilla.redhat.com/1873975 +Upstream-report: https://lists.nongnu.org/archive/html/acl-devel/2020-08/msg00000.html +--- + libacl/acl_create_entry.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libacl/acl_create_entry.c b/libacl/acl_create_entry.c +index 2214c1a..8ee72a3 100644 +--- a/libacl/acl_create_entry.c ++++ b/libacl/acl_create_entry.c +@@ -42,7 +42,7 @@ __acl_create_entry_obj(acl_obj *acl_obj_p) + entry_obj_p->eprev = acl_obj_p->aprev; + entry_obj_p->enext = (acl_entry_obj *)acl_obj_p; + entry_obj_p->eprev->enext = entry_obj_p; +- entry_obj_p->enext->eprev = entry_obj_p; ++ acl_obj_p->aprev = entry_obj_p; + + entry_obj_p->econtainer = acl_obj_p; + init_acl_entry_obj(*entry_obj_p); +-- +2.25.4 + diff --git a/acl-2.2.53.tar.gz.sig b/acl-2.2.53.tar.gz.sig new file mode 100644 index 0000000..52f5e19 Binary files /dev/null and b/acl-2.2.53.tar.gz.sig differ diff --git a/acl.spec b/acl.spec new file mode 100644 index 0000000..6d703c3 --- /dev/null +++ b/acl.spec @@ -0,0 +1,478 @@ +Summary: Access control list utilities +Name: acl +Version: 2.2.53 +Release: 9%{?dist} +BuildRequires: gawk +BuildRequires: gcc +BuildRequires: gettext +BuildRequires: libattr-devel +BuildRequires: libtool +BuildRequires: perl(FileHandle) +Requires: libacl = %{version}-%{release} +Source: https://download-mirror.savannah.gnu.org/releases/acl/acl-%{version}.tar.gz + +# avoid permission denied problem with LD_PRELOAD in the test-suite +Patch1: 0001-acl-2.2.53-test-runwrapper.patch + +# make __acl_create_entry_obj() work with LTO enabled (#1873975) +Patch2: 0002-acl-2.2.53-setattr-segv.patch + +License: GPLv2+ +URL: https://savannah.nongnu.org/projects/acl + +%description +This package contains the getfacl and setfacl utilities needed for +manipulating access control lists. + +%package -n libacl +Summary: Dynamic library for access control list support +License: LGPLv2+ +Conflicts: filesystem < 3 + +%description -n libacl +This package contains the libacl.so dynamic library which contains +the POSIX 1003.1e draft standard 17 functions for manipulating access +control lists. + +%package -n libacl-devel +Summary: Files needed for building programs with libacl +License: LGPLv2+ +Requires: libacl = %{version}-%{release}, libattr-devel + +%description -n libacl-devel +This package contains header files and documentation needed to develop +programs which make use of the access control list programming interface +defined in POSIX 1003.1e draft standard 17. + +%prep +%autosetup -p1 + +%build +%configure + +# uncomment to turn on optimizations +# sed -i 's/-O2/-O0/' libtool include/builddefs +# unset CFLAGS + +%make_build + +%check +# make the test-suite use the just built library (instead of the system one) +export LD_LIBRARY_PATH="${RPM_BUILD_ROOT}%{_libdir}:${LD_LIBRARY_PATH}" + +if ./setfacl -m "u:$(id -u):rwx" .; then + if test 0 = "$(id -u)"; then + # test/root/permissions.test requires the 'daemon' user to be a member + # of the 'bin' group in order not to fail. Prevent the test from + # running if we detect that its requirements are not met (#1085389). + if id -nG daemon | { ! grep bin >/dev/null; }; then + sed -e 's|test/root/permissions.test||' \ + -i test/Makemodule.am Makefile.in Makefile + fi + + # test/root/setfacl.test fails if 'bin' user cannot access build dir + if ! runuser -u bin -- "${PWD}/setfacl" --version; then + sed -e 's|test/root/setfacl.test||' \ + -i test/Makemodule.am Makefile.in Makefile + fi + fi + + # run the upstream test-suite + %make_build check || exit $? +else + echo '*** ACLs are probably not supported by the file system,' \ + 'the test-suite will NOT run ***' +fi + +%install +%make_install + +# get rid of libacl.a and libacl.la +rm -f $RPM_BUILD_ROOT%{_libdir}/libacl.a +rm -f $RPM_BUILD_ROOT%{_libdir}/libacl.la + +chmod 0755 $RPM_BUILD_ROOT/%{_libdir}/libacl.so.*.*.* + +# drop already installed documentation, we will use an RPM macro to install it +rm -rf $RPM_BUILD_ROOT%{_docdir}/%{name}* + +%find_lang %{name} + +%ldconfig_scriptlets -n libacl + +%files -f %{name}.lang +%{!?_licensedir:%global license %%doc} +%license doc/COPYING* +%{_bindir}/chacl +%{_bindir}/getfacl +%{_bindir}/setfacl +%{_mandir}/man1/chacl.1* +%{_mandir}/man1/getfacl.1* +%{_mandir}/man1/setfacl.1* +%{_mandir}/man5/acl.5* + +%files -n libacl-devel +%{_libdir}/libacl.so +%{_libdir}/pkgconfig/*.pc +%{_includedir}/acl +%{_includedir}/sys/acl.h +%{_mandir}/man3/acl_* + +%files -n libacl +%{_libdir}/libacl.so.* + +%changelog +* Mon Aug 31 2020 Kamil Dudka 2.2.53-9 +- make __acl_create_entry_obj() work with LTO enabled (#1873975) + +* Fri Jul 31 2020 Fedora Release Engineering - 2.2.53-8 +- Second attempt - Rebuilt for + https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Mon Jul 27 2020 Fedora Release Engineering - 2.2.53-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Wed Jun 03 2020 Tom Stellard - 2.2.53-6 +- Spec file cleanups and build fix +- Add BuildRequires: perl-FileHandle to fix make check +- Add BuildRequres: gcc [1] +- Use make_build [2] and make_install[3] macros +- [1] https://docs.fedoraproject.org/en-US/packaging-guidelines/C_and_C++/#_buildrequires_and_requires +- [2] https://docs.fedoraproject.org/en-US/packaging-guidelines/#_parallel_make +- [3] https://docs.fedoraproject.org/en-US/packaging-guidelines/#_why_the_makeinstall_macro_should_not_be_used + +* Tue Jan 28 2020 Fedora Release Engineering - 2.2.53-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Wed Jul 24 2019 Fedora Release Engineering - 2.2.53-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Thu Jan 31 2019 Fedora Release Engineering - 2.2.53-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Thu Jul 12 2018 Fedora Release Engineering - 2.2.53-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Mon Jul 02 2018 Kamil Dudka 2.2.53-1 +- new upstream release + +* Tue Mar 13 2018 Kamil Dudka 2.2.52-21 +- update link to POSIX.1e draft in acl(5) man page (#1510527) + +* Wed Feb 07 2018 Fedora Release Engineering - 2.2.52-20 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Sun Feb 04 2018 Igor Gnatenko - 2.2.52-19 +- Switch to %%ldconfig_scriptlets + +* Wed Aug 02 2017 Fedora Release Engineering - 2.2.52-18 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 2.2.52-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Mon Jul 24 2017 Kamil Dudka 2.2.52-16 +- fix test-suite failure with perl-5.26.0 (#1473845) +- update URL of the upstream source tarball + +* Thu May 18 2017 Kamil Dudka 2.2.52-15 +- setfacl.1: document the meaning of '-' in perms (#1337039) +- avoid failure of %%check when building as root (#1085389) +- apply patches automatically to ease maintenance + +* Wed May 17 2017 Kamil Dudka 2.2.52-14 +- drop obsolete BuildRoot and Group tags +- fix spurious acl_check() failure on setfacl --restore (#1451826) + +* Fri Feb 10 2017 Fedora Release Engineering - 2.2.52-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Fri Feb 03 2017 Kamil Dudka 2.2.52-12 +- update project URL (#1418474) + +* Wed Feb 03 2016 Fedora Release Engineering - 2.2.52-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Fri Aug 14 2015 Adam Jackson 2.2.52-10 +- Remove bizarre 12 year old libtool invocation workaround that prevented + hardened cflags working + +* Tue Jun 16 2015 Fedora Release Engineering - 2.2.52-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Sat Feb 21 2015 Till Maas - 2.2.52-8 +- Rebuilt for + https://fedoraproject.org/wiki/Changes/Harden_all_packages_with_position-independent_code + +* Fri Aug 15 2014 Fedora Release Engineering - 2.2.52-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Fri Jul 11 2014 Tom Callaway - 2.2.52-6 +- tag licenses properly + +* Sat Jun 07 2014 Fedora Release Engineering - 2.2.52-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Fri Nov 01 2013 Kamil Dudka 2.2.52-4 +- fix SIGSEGV of getfacl -e on overly long group name + +* Fri Aug 09 2013 Kamil Dudka 2.2.52-3 +- drop a docdir-related patch to fix a packaging failure (#993659) + +* Sat Aug 03 2013 Fedora Release Engineering - 2.2.52-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Mon May 20 2013 Kamil Dudka 2.2.52-1 +- new upstream release, drop applied patches +- drop workarounds that are no longer necessary + +* Wed Feb 13 2013 Fedora Release Engineering - 2.2.51-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Tue Aug 28 2012 Kamil Dudka 2.2.51-8 +- fix specfile issues reported by the fedora-review script + +* Wed Jul 18 2012 Fedora Release Engineering - 2.2.51-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Wed May 02 2012 Kamil Dudka 2.2.51-6 +- do not mention static libraries in the summary of libacl{,-devel} (#817952) + +* Wed Jan 25 2012 Harald Hoyer 2.2.51-5 +- add filesystem guard + +* Wed Jan 25 2012 Harald Hoyer 2.2.51-4 +- install everything in /usr + https://fedoraproject.org/wiki/Features/UsrMove + +* Thu Jan 12 2012 Fedora Release Engineering - 2.2.51-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Fri May 06 2011 Kamil Dudka 2.2.51-2 +- update project URL (#699058) + +* Thu Apr 21 2011 Kamil Dudka 2.2.51-1 +- new upstream release + +* Tue Apr 19 2011 Kamil Dudka 2.2.50-1 +- new upstream release + +* Wed Apr 06 2011 Kamil Dudka 2.2.49-11 +- add function acl_extended_file_nofollow() (#692982) + +* Tue Mar 29 2011 Kamil Dudka 2.2.49-10 +- fix typos in setfacl(1) man page (#675451) + +* Mon Feb 07 2011 Fedora Release Engineering - 2.2.49-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Thu Jul 08 2010 Kamil Dudka 2.2.49-8 +- remove dependency of libacl-devel on nfs-utils-lib and openldap + +* Tue May 25 2010 Kamil Dudka 2.2.49-7 +- let acl depend on the same version of libacl (#595674) + +* Wed Mar 24 2010 Kamil Dudka 2.2.49-6 +- prevent setfacl --restore from SIGSEGV on malformed restore file (#576550) + +* Wed Mar 10 2010 Kamil Dudka 2.2.49-5 +- run the test-suite if possible + +* Tue Jan 19 2010 Kamil Dudka 2.2.49-4 +- do not package a static library (#556036) +- remove multilib patch no longer useful +- cleanup in BuildRequires + +* Tue Jan 05 2010 Kamil Dudka 2.2.49-3 +- upstream patch for setfacl --restore SUID/SGID bits handling (#467936) + +* Sat Dec 26 2009 Kamil Dudka 2.2.49-2 +- tweaked setfacl tree walk flags (#488674), thanks to Markus Steinborn + +* Sun Dec 20 2009 Kamil Dudka 2.2.49-1 +- new upstream bugfix release +- big cleanup in patches + +* Fri Jul 24 2009 Fedora Release Engineering - 2.2.47-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Mon Feb 23 2009 Fedora Release Engineering - 2.2.47-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Thu Jul 31 2008 Jiri Moskovcak 2.2.47-3 +- little improvement to params patch +- Resolves: #457244 + +* Mon Jul 14 2008 Tom "spot" Callaway 2.2.47-2 +- rework params patch to apply with fuzz=0 +- fix license tag + +* Tue Feb 12 2008 Jiri Moskovcak 2.2.47-1 +- new upstream version + +* Mon Jan 28 2008 Jiri Moskovcak 2.2.45-3 +- Fixed segfault when using only "--" as parameter +- Resolves: #430458 + +* Wed Nov 7 2007 Jiri Moskovcak 2.2.45-2 +- Fixed setfacl exitcodes +- Resolves: #368451 + +* Wed Oct 31 2007 Jiri Moskovcak - 2.2.45-1 +- New version +- dropped walk patch + +* Thu Sep 20 2007 Jiri Moskovcak 2.2.39-10 +- Rewriten path_max patch to support long UTF8 names +- Resolves #287701, #183181 + +* Fri Aug 31 2007 Steve Dickson - 2.2.39-9 +- Removed NFS4 ACL patch since it was rejected by upstream. + +* Thu Aug 30 2007 Jeremy Katz - 2.2.39-8 +- disable nfs patch; linking libacl against libs in /usr will lead to breakage + +* Wed Aug 29 2007 Fedora Release Engineering - 2.2.39-7 +- Build Require gawk + +* Wed Aug 29 2007 Fedora Release Engineering - 2.2.39-6 +- Rebuild for selinux ppc32 issue. + +* Mon Aug 27 2007 Steve Dickson 2.2.39-5 +- Added NFS v4 ACL support + +* Thu Jul 26 2007 Jiri Moskovcak 2.2.39-4.1 +- Updated man page for getfacl + +* Wed Jul 25 2007 Jiri Moskovcak 2.2.39-4 +- Added support fort short params to getfacl +- Resolves: #204087 + +* Wed Mar 21 2007 Thomas Woerner 2.2.39-3.1 +- new improved walk patch with fixed getfacl exit code (rhbz#232884) + +* Fri Feb 23 2007 Karsten Hopp 2.2.39-3 +- fix buildroot +- remove trailing dot from summary +- -devel requires same version of libacl +- escape macro in changelog +- make .so symlink relative + +* Thu Feb 22 2007 Steve Grubb 2.2.39-2 +- Apply patch to make order consistent. + +* Wed Jul 12 2006 Jesse Keating - 2.2.39-1.1 +- rebuild + +* Wed Jul 5 2006 Thomas Woerner 2.2.39-1 +- new version 2.2.39 +- fixed usage of long UTF-8 filenames (#183181) + Thanks to Andrey for the initial patch. + +* Wed Jun 7 2006 Jeremy Katz - 2.2.34-2 +- rebuild for -devel deps + +* Fri Feb 10 2006 Jesse Keating - 2.2.34-1.2 +- bump again for double-long bug on ppc(64) + +* Tue Feb 07 2006 Jesse Keating - 2.2.34-1.1 +- rebuilt for new gcc4.1 snapshot and glibc changes + +* Fri Feb 3 2006 Thomas Woerner 2.2.34-1 +- new version 2.2.34 + +* Fri Dec 09 2005 Jesse Keating +- rebuilt + +* Tue Dec 6 2005 Thomas Woerner 2.2.32-2.1 +- fixed permissions of libacl + +* Tue Dec 6 2005 Thomas Woerner 2.2.32-2 +- spec file cleanup +- mark po files as lang specific + +* Sun Nov 06 2005 Florian La Roche +- 2.2.32 + +* Wed Sep 28 2005 Than Ngo 2.2.31-1 +- update to 2.2.31 + +* Wed Sep 28 2005 Than Ngo 2.2.23-9 +- get rid of *.la files +- remove duplicate doc files + +* Wed Feb 9 2005 Stephen C. Tweedie 2.2.23-6 +- Rebuild + +* Thu Sep 16 2004 Jeremy Katz - 2.2.23-5 +- make the libs executable so that we find their dependencies (#132696) + +* Fri Sep 10 2004 Stephen C. Tweedie 2.2.23-4 +- libacl-devel Requires: libattr-devel for libattr.la + +* Fri Sep 10 2004 Stephen C. Tweedie 2.2.23-3 +- Requires libtool >= 1.5 for building + +* Thu Aug 19 2004 Phil Knirsch 2.2.23-2 +- Make libacl.so.* executable. + +* Thu Aug 19 2004 Phil Knirsch 2.2.23-1 +- Update to latest upstream version. + +* Sun Aug 8 2004 Alan Cox 2.2.7-7 +- Close bug #125300 (Steve Grubb: build requires libtool,gettext) + +* Tue Jun 15 2004 Elliot Lee +- rebuilt + +* Wed Mar 31 2004 Stephen C. Tweedie 2.2.7-5 +- Add missing %%defattr + +* Tue Mar 30 2004 Stephen C. Tweedie 2.2.7-3 +- Add /usr/include/acl to files manifest +- Fix location of doc files, add main doc dir to files manifest + +* Tue Mar 02 2004 Elliot Lee +- rebuilt + +* Fri Feb 13 2004 Elliot Lee +- rebuilt + +* Tue Aug 5 2003 Elliot Lee 2.2.7-2 +- Fix libtool invocation + +* Tue Jun 3 2003 Stephen C. Tweedie 2.2.7-1 +- Update to acl-2.2.7 + +* Wed Mar 26 2003 Michael K. Johnson 2.2.3-2 +- include patch from Jay Berkenbilt to print better error messages + +* Tue Jan 28 2003 Michael K. Johnson 2.2.3-1 +- udpate/rebuild + +* Sat Jan 4 2003 Jeff Johnson 2.0.11-7 +- set execute bits on library so that requires are generated. + +* Tue Nov 19 2002 Elliot Lee 2.0.11-5 +- Correct patch in previous fix so that shared libraries go in /lib* + instead of /usr/lib* + +* Tue Nov 19 2002 Elliot Lee 2.0.11-4 +- Fix multilibbing + +* Wed Sep 11 2002 Than Ngo 2.0.11-3 +- Added fix to install libs in correct directory on 64bit machine + +* Thu Aug 08 2002 Michael K. Johnson 2.0.11-2 +- Made the package only own the one directory that is unique to it: + /usr/include/acl + +* Mon Jun 24 2002 Michael K. Johnson 2.0.11-1 +- Initial Red Hat package + Made as few changes as possible relative to upstream packaging to + make it easier to maintain long-term. This means that some of + the techniques used here are definitely not standard Red Hat + techniques. If you are looking for an example package to fit + into Red Hat Linux transparently, this would not be the one to + pick. +- acl-devel -> libacl-devel diff --git a/sources b/sources new file mode 100644 index 0000000..d8584fe --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (acl-2.2.53.tar.gz) = 176b7957fe0e7618e0b7bf2ac5071f7fa29417df718cce977661a576fa184e4af9d303b591c9d556b6ba8923e799457343afa401f5a9f7ecd9022185a4e06716 diff --git a/tests/cmd-line-options/Makefile b/tests/cmd-line-options/Makefile new file mode 100644 index 0000000..d4136cc --- /dev/null +++ b/tests/cmd-line-options/Makefile @@ -0,0 +1,88 @@ +# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material +# is made available to anyone wishing to use, modify, copy, or +# redistribute it subject to the terms and conditions of the GNU General +# Public License v.2. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Author: Milos Malik + +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# +# Example Makefile for RHTS # +# This example is geared towards a test for a specific package # +# It does most of the work for you, but may require further coding # +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# + +# The toplevel namespace within which the test lives. +# FIXME: You will need to change this: +TOPLEVEL_NAMESPACE=CoreOS + +# The name of the package under test: +# FIXME: you wil need to change this: +PACKAGE_NAME=acl + +# The path of the test below the package: +# FIXME: you wil need to change this: +RELATIVE_PATH=Sanity/cmd-line-options + +# Version of the test. Used with make tag. +export TESTVERSION=1.0 + +# The combined namespace of the test. +export TEST=/$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH) + + +# A phony target is one that is not really the name of a file. +# It is just a name for some commands to be executed when you +# make an explicit request. There are two reasons to use a +# phony target: to avoid a conflict with a file of the same +# name, and to improve performance. +.PHONY: all install download clean + +# executables to be built should be added here, they will be generated on the system under test. +BUILT_FILES= + +# data files, .c files, scripts anything needed to either compile the test and/or run it. +FILES=$(METADATA) runtest.sh Makefile PURPOSE test-core.sh + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + chmod a+x ./runtest.sh ./test-core.sh + +clean: + rm -f *~ *.rpm $(BUILT_FILES) + +# You may need to add other targets e.g. to build executables from source code +# Add them here: + + +# Include Common Makefile +include /usr/share/rhts/lib/rhts-make.include + +# Generate the testinfo.desc here: +$(METADATA): Makefile + @touch $(METADATA) +# Change to the test owner's name + @echo "Owner: Milos Malik " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "Description: utilities are tested if they support basic command line options" >> $(METADATA) + @echo "TestTime: 2m" >> $(METADATA) + @echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA) +# add any other packages for which your test ought to run here + @echo "Requires: $(PACKAGE_NAME)" >> $(METADATA) +# add any other requirements for the script to run here + @echo "License: GPLv2" >> $(METADATA) + +# You may need other fields here; see the documentation + rhts-lint $(METADATA) diff --git a/tests/cmd-line-options/PURPOSE b/tests/cmd-line-options/PURPOSE new file mode 100644 index 0000000..cbf7099 --- /dev/null +++ b/tests/cmd-line-options/PURPOSE @@ -0,0 +1,5 @@ +Test Name: cmd-line-options +Author: Milos Malik +Location: /CoreOS/acl/Sanity/cmd-line-options +Short Description: Utilities are tested if they support basic command line options. +Safe: yes diff --git a/tests/cmd-line-options/runtest.sh b/tests/cmd-line-options/runtest.sh new file mode 100755 index 0000000..a852c11 --- /dev/null +++ b/tests/cmd-line-options/runtest.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material +# is made available to anyone wishing to use, modify, copy, or +# redistribute it subject to the terms and conditions of the GNU General +# Public License v.2. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Author: Milos Malik + +rhts-run-simple-test $TEST ./test-core.sh diff --git a/tests/cmd-line-options/test-core.sh b/tests/cmd-line-options/test-core.sh new file mode 100755 index 0000000..92d8aed --- /dev/null +++ b/tests/cmd-line-options/test-core.sh @@ -0,0 +1,113 @@ +#!/bin/sh +# Description: sanity test for acl package +# Author: Milos Malik + +##### Variable Declaration ##### +VERSION=1.0 + +# FAIL unless test explicitly passes +RESULT=FAIL + +# Each pass increases SCORE by 1 +SCORE=0 +TOTAL=8 + +# Set language so we know what results to test for +set_lang=0 +old_lang=$LANG +new_lang=en_US.UTF-8 + +# Which package and which utility do we test? +PACKAGE=acl + +##### Function Declaration ##### + +log () { + printf "\n:: $1 ::\n" +} + +check_exit_code () { + echo -e "\t* exit code: $1" + if [ $1 $2 $3 ] ; then + let "SCORE += 1" + fi +} + +##### Begin Test ##### + +log "[`date +%H:%M:%S`] Begin Test - $TEST-$VERSION" + +# Warn if not running as root that test might fail +e_user=$(whoami) +if [[ x"${e_user}" != x"root" ]]; then + log "Warning, not running as root! This test might fail." +fi + +# Temporarily set LANG to value we can trust results from +if [[ x"${LANG}" != x"${new_lang}" ]]; then + log "Warning, LANG not set to ${new_lang}!" + log "Temporarily setting LANG to ${new_lang}, was ${old_lang}" + + set_lang=1 + export LANG=${new_lang} + log "Done, LANG=${new_lang}." +fi + +log "getfacl -h" +getfacl -h >& /dev/null +check_exit_code $? -eq 0 + +log "getfacl --help" +getfacl --help >& /dev/null +check_exit_code $? -eq 0 + +log "getfacl -v" +getfacl -v >& /dev/null +check_exit_code $? -eq 0 + +log "getfacl --version" +getfacl --version >& /dev/null +check_exit_code $? -eq 0 + +log "setfacl -h" +setfacl -h >& /dev/null +check_exit_code $? -eq 0 + +log "setfacl --help" +setfacl --help >& /dev/null +check_exit_code $? -eq 0 + +log "setfacl -v" +setfacl -v >& /dev/null +check_exit_code $? -eq 0 + +log "setfacl --version" +setfacl --version >& /dev/null +check_exit_code $? -eq 0 + +# Reset LANG to original value +if [[ ${set_lang} == 1 ]]; then + log "Resetting LANG to ${old_lang}." + export LANG=${old_lang} + log "Done, LANG=${old_lang}." +fi + +log "[`date +%H:%M:%S`] End Test - $TEST-$VERSION" + +##### Report results ##### + +log "SCORE: ${SCORE}/${TOTAL}" + +if [ ${SCORE} -eq ${TOTAL} ] ; then +# everything was OK + log "RESULT: PASS" + printf "\n\n" + exit 0 +else +# something failed + log "RESULT: FAIL" + printf "\n\n" + exit 1 +fi + +##### End Test ##### diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..d6fb2ff --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,13 @@ +--- +# This first play always runs on the local staging system +- hosts: localhost + roles: + - role: standard-test-beakerlib + tags: + - classic + - container + - atomic + tests: + - cmd-line-options + required_packages: + - which # which package required for cmd-line-options