diff options
-rwxr-xr-x | autogen.sh | 4 | ||||
-rwxr-xr-x | beecrypt/autogen.sh | 4 | ||||
-rw-r--r-- | elfutils/lib/Makefile.am | 29 | ||||
-rw-r--r-- | elfutils/libasm/Makefile.am | 2 | ||||
-rw-r--r-- | elfutils/libdw/Makefile.am | 2 | ||||
-rw-r--r-- | elfutils/libdwarf/Makefile.am | 2 | ||||
-rw-r--r-- | elfutils/libebl/Makefile.am | 2 | ||||
-rw-r--r-- | elfutils/libelf/Makefile.am | 2 | ||||
-rw-r--r-- | elfutils/tests/Makefile.am | 108 | ||||
-rwxr-xr-x | expat/autogen.sh | 4 | ||||
-rwxr-xr-x | file/autogen.sh | 4 | ||||
-rw-r--r-- | lib/cpio.c | 2 | ||||
-rw-r--r-- | lib/cpio.h | 4 | ||||
-rw-r--r-- | lib/fsm.c | 77 |
14 files changed, 153 insertions, 93 deletions
diff --git a/autogen.sh b/autogen.sh index b103cc082..cbdc9861b 100755 --- a/autogen.sh +++ b/autogen.sh @@ -5,12 +5,12 @@ export LDFLAGS LTV="libtoolize (GNU libtool) 1.4.3" ACV="autoconf (GNU Autoconf) 2.57" -AMV="automake (GNU automake) 1.6.3" +AMV="automake (GNU automake) 1.7.3" USAGE=" This script documents the versions of the tools I'm using to build rpm: libtool-1.4.3 autoconf-2.57 - automake-1.6.3 + automake-1.7.3 Simply edit this script to change the libtool/autoconf/automake versions checked if you need to, as rpm should build (and has built) with all recent versions of libtool/autoconf/automake. diff --git a/beecrypt/autogen.sh b/beecrypt/autogen.sh index 0a7254f1d..b35834fc9 100755 --- a/beecrypt/autogen.sh +++ b/beecrypt/autogen.sh @@ -5,12 +5,12 @@ export LDFLAGS LTV="libtoolize (GNU libtool) 1.4.3" ACV="autoconf (GNU Autoconf) 2.57" -AMV="automake (GNU automake) 1.6.3" +AMV="automake (GNU automake) 1.7.3" USAGE=" This script documents the versions of the tools I'm using to build rpm: libtool-1.4.3 autoconf-2.57 - automake-1.6.3 + automake-1.7.3 Simply edit this script to change the libtool/autoconf/automake versions checked if you need to, as rpm should build (and has built) with all recent versions of libtool/autoconf/automake. diff --git a/elfutils/lib/Makefile.am b/elfutils/lib/Makefile.am index a41d15d8f..54dad0123 100644 --- a/elfutils/lib/Makefile.am +++ b/elfutils/lib/Makefile.am @@ -1,12 +1,25 @@ ## Process this file with automake to create Makefile.in - -AUTOMAKE_OPTIONS = 1.4 gnits - -noinst_LTLIBRARIES = libbu.la - +## Configure input file for elfutils. +## +## Copyright (C) 1996-2001, 2002 Red Hat, Inc. +## +## This program is Open Source software; you can redistribute it and/or +## modify it under the terms of the Open Software License version 1.0 as +## published by the Open Source Initiative. +## +## You should have received a copy of the Open Software License along +## with this program; if not, you may obtain a copy of the Open Software +## License version 1.0 from http://www.opensource.org/licenses/osl.php or +## by writing the Open Source Initiative c/o Lawrence Rosen, Esq., +## 3001 King Ranch Road, Ukiah, CA 95482. +## +DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H +AM_CFLAGS = -Wall # -Werror INCLUDES = -I$(srcdir)/../libelf -I.. -libbu_la_SOURCES = xstrdup.c xstrndup.c xmalloc.c next_prime.c +noinst_LIBRARIES = libeu.a + +libeu_a_SOURCES = xstrdup.c xstrndup.c xmalloc.c next_prime.c crc32.c -noinst_HEADERS = fixedsizehash.h system.h \ - dynamicsizehash.h dynamicsizehash.c +noinst_HEADERS = fixedsizehash.h system.h dynamicsizehash.h +EXTRA_DIST = dynamicsizehash.c diff --git a/elfutils/libasm/Makefile.am b/elfutils/libasm/Makefile.am index b96884a1d..08c18103b 100644 --- a/elfutils/libasm/Makefile.am +++ b/elfutils/libasm/Makefile.am @@ -14,7 +14,7 @@ ## 3001 King Ranch Road, Ukiah, CA 95482. ## DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -AM_CFLAGS = -Wall -Werror +AM_CFLAGS = -Wall # -Werror INCLUDES = -I. -I$(srcdir) -I.. -I$(top_srcdir)/libelf -I$(top_srcdir)/libebl \ -I$(top_srcdir)/lib GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include) diff --git a/elfutils/libdw/Makefile.am b/elfutils/libdw/Makefile.am index 043e69230..366739e9a 100644 --- a/elfutils/libdw/Makefile.am +++ b/elfutils/libdw/Makefile.am @@ -17,7 +17,7 @@ ## Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ## DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -AM_CFLAGS = -Wall -Werror -Wshadow +AM_CFLAGS = -Wall -Wshadow # -Werror INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I.. -I$(srcdir)/../lib LINT = splint diff --git a/elfutils/libdwarf/Makefile.am b/elfutils/libdwarf/Makefile.am index d53efbe20..ee26ef867 100644 --- a/elfutils/libdwarf/Makefile.am +++ b/elfutils/libdwarf/Makefile.am @@ -14,7 +14,7 @@ ## 3001 King Ranch Road, Ukiah, CA 95482. ## DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DDWARF_DEBUG -AM_CFLAGS = -Wall -Werror +AM_CFLAGS = -Wall # -Werror INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I.. -I$(srcdir)/../lib VERSION = 1 diff --git a/elfutils/libebl/Makefile.am b/elfutils/libebl/Makefile.am index b705babad..2b67ff523 100644 --- a/elfutils/libebl/Makefile.am +++ b/elfutils/libebl/Makefile.am @@ -14,7 +14,7 @@ ## 3001 King Ranch Road, Ukiah, CA 95482. ## DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -Wall -AM_CFLAGS = -Wall -Werror -DOBJDIR=\"$(shell pwd)\" +AM_CFLAGS = -Wall -DOBJDIR=\"$(shell pwd)\" # -Werror LINT = splint diff --git a/elfutils/libelf/Makefile.am b/elfutils/libelf/Makefile.am index 4da834536..9458ddb11 100644 --- a/elfutils/libelf/Makefile.am +++ b/elfutils/libelf/Makefile.am @@ -14,7 +14,7 @@ ## 3001 King Ranch Road, Ukiah, CA 95482. ## DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -AM_CFLAGS = -Wall -Werror +AM_CFLAGS = -Wall # -Werror INCLUDES = -I$(srcdir) -I$(top_srcdir)/lib -I.. GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include) VERSION = 1 diff --git a/elfutils/tests/Makefile.am b/elfutils/tests/Makefile.am index 47555e8d5..0d453043d 100644 --- a/elfutils/tests/Makefile.am +++ b/elfutils/tests/Makefile.am @@ -1,9 +1,22 @@ ## Process this file with automake to create Makefile.in - -AUTOMAKE_OPTIONS = 1.4 gnits +## Configure input file for elfutils. +## +## Copyright (C) 1996-2001, 2002 Red Hat, Inc. +## +## This program is Open Source software; you can redistribute it and/or +## modify it under the terms of the Open Software License version 1.0 as +## published by the Open Source Initiative. +## +## You should have received a copy of the Open Software License along +## with this program; if not, you may obtain a copy of the Open Software +## License version 1.0 from http://www.opensource.org/licenses/osl.php or +## by writing the Open Source Initiative c/o Lawrence Rosen, Esq., +## 3001 King Ranch Road, Ukiah, CA 95482. +## DEFS = -DHAVE_CONFIG_H -D_GNU_SOURCE -AM_CFLAGS = -Wall -Werror +AM_CFLAGS = -Wall # -Werror INCLUDES = -I$(top_srcdir)/libasm -I$(top_srcdir)/libdwarf \ + -I$(top_srcdir)/libdw \ -I$(top_srcdir)/libebl -I$(top_srcdir)/libelf \ -I$(top_srcdir)/lib -I.. @@ -12,7 +25,9 @@ noinst_PROGRAMS = arextract arsymtest newfile saridx scnnames sectiondump \ get-cus firstdie show-dies show-tags show-die-info1 \ show-die-info2 get-lines get-files get-pubnames get-aranges \ show-ciefde show-abbrev hash asm-tst1 asm-tst2 asm-tst3 \ - asm-tst4 asm-tst5 asm-tst6 asm-tst7 asm-tst8 msg_tst + asm-tst4 asm-tst5 asm-tst6 asm-tst7 asm-tst8 asm-tst9 \ + msg_tst newscn ecp \ + get-pubnames2 TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \ update1 update2 update3 update4 run-get-cus.sh \ @@ -20,47 +35,60 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \ run-show-die-info1.sh run-show-die-info2.sh run-get-files.sh \ run-get-lines.sh run-get-pubnames.sh run-get-aranges.sh \ run-show-ciefde.sh run-show-abbrev.sh hash asm-tst1 asm-tst2 \ - asm-tst3 asm-tst4 asm-tst5 asm-tst6 asm-tst7 asm-tst8 msg_tst + asm-tst3 asm-tst4 asm-tst5 asm-tst6 asm-tst7 asm-tst8 asm-tst9 \ + msg_tst newscn run-strip-test.sh run-strip-test2.sh \ + run-get-pubnames2.sh run-ecp-test.sh run-ecp-test2.sh EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-firstdie.sh \ run-show-dies.sh run-show-tags.sh run-show-die-info1.sh \ run-show-die-info2.sh run-get-files.sh run-get-lines.sh \ run-get-pubnames.sh run-get-aranges.sh run-get-cus.sh \ - run-show-ciefde.sh run-show-abbrev.sh + run-show-ciefde.sh run-show-abbrev.sh run-strip-test.sh \ + run-strip-test2.sh run-ecp-test.sh run-ecp-test2.sh \ + run-get-pubnames2.sh \ + testfile testfile2 testfile3 testfile4 testfile5 \ + testfile6.bz2 testfile7.bz2 testfile8.bz2 testfile9.bz2 \ + testfile10 + +TESTS_ENVIRONMENT = LD_LIBRARY_PATH="../libelf:../libebl:../libasm:../libdwarf:../libdw$${LD_LIBRARY_PATH:+:}$$LD_LIBRARY_PATH" -arextract_LDADD = ../libelf/libelf.la -arsymtest_LDADD = ../libelf/libelf.la -newfile_LDADD = ../libelf/libelf.la -saridx_LDADD = ../libelf/libelf.la -scnnames_LDADD = ../libelf/libelf.la -sectiondump_LDADD = ../libelf/libelf.la -showptable_LDADD = ../libelf/libelf.la -update1_LDADD = ../libelf/libelf.la -update2_LDADD = ../libelf/libelf.la -update3_LDADD = ../libebl/libebl.la ../libelf/libelf.la ../lib/libbu.la -update4_LDADD = ../libebl/libebl.la ../libelf/libelf.la ../lib/libbu.la -test_nlist_LDADD = ../libelf/libelf.la -get_cus_LDADD = ../libdwarf/libdwarf.la ../libelf/libelf.la -firstdie_LDADD = ../libdwarf/libdwarf.la ../libelf/libelf.la -show_dies_LDADD = ../libdwarf/libdwarf.la ../libelf/libelf.la -show_tags_LDADD = ../libdwarf/libdwarf.la ../libelf/libelf.la -show_die_info1_LDADD = ../libdwarf/libdwarf.la ../libelf/libelf.la -show_die_info2_LDADD = ../libdwarf/libdwarf.la ../libelf/libelf.la -get_lines_LDADD = ../libdwarf/libdwarf.la ../libelf/libelf.la -get_files_LDADD = ../libdwarf/libdwarf.la ../libelf/libelf.la -get_pubnames_LDADD = ../libdwarf/libdwarf.la ../libelf/libelf.la -get_aranges_LDADD = ../libdwarf/libdwarf.la ../libelf/libelf.la -show_ciefde_LDADD = ../libdwarf/libdwarf.la ../libelf/libelf.la -show_abbrev_LDADD = ../libdwarf/libdwarf.la ../libelf/libelf.la -hash_LDADD = ../libelf/libelf.la -asm_tst1_LDADD = ../libasm/libasm.la ../libebl/libebl.la ../libelf/libelf.la -asm_tst2_LDADD = ../libasm/libasm.la ../libebl/libebl.la ../libelf/libelf.la -asm_tst3_LDADD = ../libasm/libasm.la ../libebl/libebl.la ../libelf/libelf.la -asm_tst4_LDADD = ../libasm/libasm.la ../libebl/libebl.la ../libelf/libelf.la -asm_tst5_LDADD = ../libasm/libasm.la ../libebl/libebl.la ../libelf/libelf.la -asm_tst6_LDADD = ../libasm/libasm.la ../libebl/libebl.la ../libelf/libelf.la -asm_tst7_LDADD = ../libasm/libasm.la ../libebl/libebl.la ../libelf/libelf.la -asm_tst8_LDADD = ../libasm/libasm.la ../libebl/libebl.la ../libelf/libelf.la -msg_tst_LDADD = ../libelf/libelf.la +arextract_LDADD = ../libelf/libelf.so +arsymtest_LDADD = ../libelf/libelf.so +newfile_LDADD = ../libelf/libelf.so +saridx_LDADD = ../libelf/libelf.so +scnnames_LDADD = ../libelf/libelf.so +sectiondump_LDADD = ../libelf/libelf.so +showptable_LDADD = ../libelf/libelf.so +update1_LDADD = ../libelf/libelf.so +update2_LDADD = ../libelf/libelf.so +update3_LDADD = ../libebl/libebl.so ../libelf/libelf.so +update4_LDADD = ../libebl/libebl.so ../libelf/libelf.so +test_nlist_LDADD = ../libelf/libelf.so +get_cus_LDADD = ../libdwarf/libdwarf.so ../libelf/libelf.so +firstdie_LDADD = ../libdwarf/libdwarf.so ../libelf/libelf.so +show_dies_LDADD = ../libdwarf/libdwarf.so ../libelf/libelf.so +show_tags_LDADD = ../libdwarf/libdwarf.so ../libelf/libelf.so +show_die_info1_LDADD = ../libdwarf/libdwarf.so ../libelf/libelf.so +show_die_info2_LDADD = ../libdwarf/libdwarf.so ../libelf/libelf.so +get_lines_LDADD = ../libdwarf/libdwarf.so ../libelf/libelf.so +get_files_LDADD = ../libdwarf/libdwarf.so ../libelf/libelf.so +get_pubnames_LDADD = ../libdwarf/libdwarf.so ../libelf/libelf.so +get_aranges_LDADD = ../libdwarf/libdwarf.so ../libelf/libelf.so +show_ciefde_LDADD = ../libdwarf/libdwarf.so ../libelf/libelf.so +show_abbrev_LDADD = ../libdwarf/libdwarf.so ../libelf/libelf.so +hash_LDADD = ../libelf/libelf.so +asm_tst1_LDADD = ../libasm/libasm.so ../libebl/libebl.so ../libelf/libelf.so +asm_tst2_LDADD = ../libasm/libasm.so ../libebl/libebl.so ../libelf/libelf.so +asm_tst3_LDADD = ../libasm/libasm.so ../libebl/libebl.so ../libelf/libelf.so +asm_tst4_LDADD = ../libasm/libasm.so ../libebl/libebl.so ../libelf/libelf.so +asm_tst5_LDADD = ../libasm/libasm.so ../libebl/libebl.so ../libelf/libelf.so +asm_tst6_LDADD = ../libasm/libasm.so ../libebl/libebl.so ../libelf/libelf.so +asm_tst7_LDADD = ../libasm/libasm.so ../libebl/libebl.so ../libelf/libelf.so +asm_tst8_LDADD = ../libasm/libasm.so ../libebl/libebl.so ../libelf/libelf.so +asm_tst9_LDADD = ../libasm/libasm.so ../libebl/libebl.so ../libelf/libelf.so +msg_tst_LDADD = ../libelf/libelf.so +newscn_LDADD = ../libelf/libelf.so +ecp_LDADD = ../libelf/libelf.so +get_pubnames2_LDADD = ../libdw/libdw.so ../libelf/libelf.so CLEANFILES = xxx diff --git a/expat/autogen.sh b/expat/autogen.sh index 0a7254f1d..b35834fc9 100755 --- a/expat/autogen.sh +++ b/expat/autogen.sh @@ -5,12 +5,12 @@ export LDFLAGS LTV="libtoolize (GNU libtool) 1.4.3" ACV="autoconf (GNU Autoconf) 2.57" -AMV="automake (GNU automake) 1.6.3" +AMV="automake (GNU automake) 1.7.3" USAGE=" This script documents the versions of the tools I'm using to build rpm: libtool-1.4.3 autoconf-2.57 - automake-1.6.3 + automake-1.7.3 Simply edit this script to change the libtool/autoconf/automake versions checked if you need to, as rpm should build (and has built) with all recent versions of libtool/autoconf/automake. diff --git a/file/autogen.sh b/file/autogen.sh index 0a7254f1d..b35834fc9 100755 --- a/file/autogen.sh +++ b/file/autogen.sh @@ -5,12 +5,12 @@ export LDFLAGS LTV="libtoolize (GNU libtool) 1.4.3" ACV="autoconf (GNU Autoconf) 2.57" -AMV="automake (GNU automake) 1.6.3" +AMV="automake (GNU automake) 1.7.3" USAGE=" This script documents the versions of the tools I'm using to build rpm: libtool-1.4.3 autoconf-2.57 - automake-1.6.3 + automake-1.7.3 Simply edit this script to change the libtool/autoconf/automake versions checked if you need to, as rpm should build (and has built) with all recent versions of libtool/autoconf/automake. diff --git a/lib/cpio.c b/lib/cpio.c index c72c5361d..24bb52e89 100644 --- a/lib/cpio.c +++ b/lib/cpio.c @@ -235,6 +235,8 @@ const char *const cpioStrerror(int rc) case CPIOERR_MD5SUM_MISMATCH: s = _("MD5 sum mismatch"); break; case CPIOERR_INTERNAL: s = _("Internal error"); break; case CPIOERR_UNMAPPED_FILE: s = _("Archive file not in header"); break; + case CPIOERR_ENOENT: s = strerror(ENOENT); break; + case CPIOERR_ENOTEMPTY: s = strerror(ENOTEMPTY); break; } /*@=branchstate@*/ diff --git a/lib/cpio.h b/lib/cpio.h index b6ef297e8..3f95a55b7 100644 --- a/lib/cpio.h +++ b/lib/cpio.h @@ -47,7 +47,9 @@ enum cpioErrorReturns { CPIOERR_MISSING_HARDLINK= (25 ), CPIOERR_MD5SUM_MISMATCH = (26 ), CPIOERR_INTERNAL = (27 ), - CPIOERR_UNMAPPED_FILE = (28 ) + CPIOERR_UNMAPPED_FILE = (28 ), + CPIOERR_ENOENT = (29 ), + CPIOERR_ENOTEMPTY = (30 ) }; /** \ingroup payload @@ -572,10 +572,10 @@ int fsmSetup(FSM_t fsm, fileStage goal, } ec = fsm->rc = 0; - rc = fsmNext(fsm, FSM_CREATE); + rc = fsmUNSAFE(fsm, FSM_CREATE); if (rc && !ec) ec = rc; - rc = fsmNext(fsm, fsm->goal); + rc = fsmUNSAFE(fsm, fsm->goal); if (rc && !ec) ec = rc; /*@-boundswrite@*/ @@ -591,7 +591,7 @@ int fsmTeardown(FSM_t fsm) int rc = fsm->rc; if (!rc) - rc = fsmNext(fsm, FSM_DESTROY); + rc = fsmUNSAFE(fsm, FSM_DESTROY); fsm->iter = mapFreeIterator(fsm->iter); if (fsm->cfd != NULL) { @@ -851,7 +851,7 @@ static int writeFile(/*@special@*/ FSM_t fsm, int writeData) * I don't think that's a specified standard. */ /* XXX NUL terminated result in fsm->rdbuf, len in fsm->rdnb. */ - rc = fsmNext(fsm, FSM_READLINK); + rc = fsmUNSAFE(fsm, FSM_READLINK); if (rc) goto exit; st->st_size = fsm->rdnb; symbuf = alloca_strdup(fsm->rdbuf); /* XXX save readlink return. */ @@ -1048,7 +1048,7 @@ static int fsmMakeLinks(/*@special@*/ FSM_t fsm) rc = fsmUNSAFE(fsm, FSM_VERIFY); if (!rc) continue; - if (rc != CPIOERR_LSTAT_FAILED) break; + if (!(rc == CPIOERR_ENOENT)) break; /* XXX link(fsm->opath, fsm->path) */ rc = fsmNext(fsm, FSM_LINK); @@ -1251,7 +1251,7 @@ static int fsmMkdirs(/*@special@*/ FSM_t fsm) if (rc == 0 && S_ISDIR(ost->st_mode)) { /* Move pre-existing path marker forward. */ fsm->dnlx[dc] = (te - dn); - } else if (rc == CPIOERR_LSTAT_FAILED) { + } else if (rc == CPIOERR_ENOENT) { rpmfi fi = fsmGetFi(fsm); *te = '\0'; st->st_mode = S_IFDIR | (fi->dperms & 07777); @@ -1305,9 +1305,9 @@ static int fsmStat(FSM_t fsm) if (fsm->path != NULL) { int saveernno = errno; - rc = fsmNext(fsm, (!(fsm->mapFlags & CPIO_FOLLOW_SYMLINKS) + rc = fsmUNSAFE(fsm, (!(fsm->mapFlags & CPIO_FOLLOW_SYMLINKS) ? FSM_LSTAT : FSM_STAT)); - if (rc == CPIOERR_LSTAT_FAILED && errno == ENOENT) { + if (rc == CPIOERR_ENOENT) { errno = saveerrno; rc = 0; fsm->exists = 0; @@ -1587,9 +1587,9 @@ int fsmStage(FSM_t fsm, fileStage stage) if (fsm->path != NULL && !(fsm->goal == FSM_PKGINSTALL && S_ISREG(st->st_mode))) { - rc = fsmNext(fsm, (!(fsm->mapFlags & CPIO_FOLLOW_SYMLINKS) + rc = fsmUNSAFE(fsm, (!(fsm->mapFlags & CPIO_FOLLOW_SYMLINKS) ? FSM_LSTAT : FSM_STAT)); - if (rc == CPIOERR_LSTAT_FAILED && errno == ENOENT) { + if (rc == CPIOERR_ENOENT) { errno = saveerrno; rc = 0; fsm->exists = 0; @@ -1691,12 +1691,12 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break; /*@-dependenttrans@*/ fsm->path = path; /*@=dependenttrans@*/ - if (rc != CPIOERR_LSTAT_FAILED) return rc; + if (!(rc == CPIOERR_ENOENT)) return rc; rc = expandRegular(fsm); } else if (S_ISDIR(st->st_mode)) { mode_t st_mode = st->st_mode; rc = fsmUNSAFE(fsm, FSM_VERIFY); - if (rc == CPIOERR_LSTAT_FAILED) { + if (rc == CPIOERR_ENOENT) { st->st_mode &= ~07777; /* XXX abuse st->st_mode */ st->st_mode |= 00700; rc = fsmNext(fsm, FSM_MKDIR); @@ -1724,14 +1724,14 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break; fsm->opath = fsm->wrbuf; /*@=dependenttrans@*/ rc = fsmUNSAFE(fsm, FSM_VERIFY); - if (rc == CPIOERR_LSTAT_FAILED) + if (rc == CPIOERR_ENOENT) rc = fsmNext(fsm, FSM_SYMLINK); fsm->opath = opath; /* XXX restore fsm->path */ } else if (S_ISFIFO(st->st_mode)) { mode_t st_mode = st->st_mode; /* This mimics cpio S_ISSOCK() behavior but probably isnt' right */ rc = fsmUNSAFE(fsm, FSM_VERIFY); - if (rc == CPIOERR_LSTAT_FAILED) { + if (rc == CPIOERR_ENOENT) { st->st_mode = 0000; /* XXX abuse st->st_mode */ rc = fsmNext(fsm, FSM_MKFIFO); st->st_mode = st_mode; /* XXX restore st->st_mode */ @@ -1741,7 +1741,7 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break; /*@-unrecog@*/ S_ISSOCK(st->st_mode) /*@=unrecog@*/) { rc = fsmUNSAFE(fsm, FSM_VERIFY); - if (rc == CPIOERR_LSTAT_FAILED) + if (rc == CPIOERR_ENOENT) rc = fsmNext(fsm, FSM_MKNOD); } else { /* XXX Special case /dev/log, which shouldn't be packaged anyways */ @@ -1833,9 +1833,9 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break; if (S_ISDIR(st->st_mode)) { rc = fsmNext(fsm, FSM_RMDIR); if (!rc) break; - switch (errno) { - case ENOENT: /* XXX rmdir("/") linux 2.2.x kernel hack */ - case ENOTEMPTY: + switch (rc) { + case CPIOERR_ENOENT: /* XXX rmdir("/") linux 2.2.x kernel hack */ + case CPIOERR_ENOTEMPTY: /* XXX make sure that build side permits %missingok on directories. */ if (fsm->fflags & RPMFILE_MISSINGOK) /*@innerbreak@*/ break; @@ -1856,11 +1856,18 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break; } else { rc = fsmNext(fsm, FSM_UNLINK); if (!rc) break; - if (!(errno == ENOENT && (fsm->fflags & RPMFILE_MISSINGOK))) + switch (rc) { + case CPIOERR_ENOENT: + if (fsm->fflags & RPMFILE_MISSINGOK) + /*@innerbreak@*/ break; + /*@fallthrough@*/ + default: rpmError( (strict_erasures ? RPMERR_UNLINK : RPMDEBUG_UNLINK), _("%s unlink of %s failed: %s\n"), rpmfiTypeString(fi), fsm->path, strerror(errno)); + /*@innerbreak@*/ break; + } } } /* XXX Failure to remove is not (yet) cause for failure. */ @@ -1953,7 +1960,7 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break; break; case FSM_VERIFY: if (fsm->diskchecked && !fsm->exists) { - rc = CPIOERR_LSTAT_FAILED; + rc = CPIOERR_ENOENT; break; } if (S_ISREG(st->st_mode)) { @@ -1974,13 +1981,13 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break; rc = CPIOERR_UNLINK_FAILED; fsm->path = fsm->opath; fsm->opath = NULL; - return (rc ? rc : CPIOERR_LSTAT_FAILED); /* XXX HACK */ + return (rc ? rc : CPIOERR_ENOENT); /* XXX HACK */ /*@notreached@*/ break; } else if (S_ISDIR(st->st_mode)) { if (S_ISDIR(ost->st_mode)) return 0; if (S_ISLNK(ost->st_mode)) { - rc = fsmStage(fsm, FSM_STAT); - if (rc == CPIOERR_STAT_FAILED && errno == ENOENT) rc = 0; + rc = fsmUNSAFE(fsm, FSM_STAT); + if (rc == CPIOERR_ENOENT) rc = 0; if (rc) break; errno = saveerrno; if (S_ISDIR(ost->st_mode)) return 0; @@ -1988,7 +1995,7 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break; } else if (S_ISLNK(st->st_mode)) { if (S_ISLNK(ost->st_mode)) { /* XXX NUL terminated result in fsm->rdbuf, len in fsm->rdnb. */ - rc = fsmNext(fsm, FSM_READLINK); + rc = fsmUNSAFE(fsm, FSM_READLINK); errno = saveerrno; if (rc) break; if (!strcmp(fsm->opath, fsm->rdbuf)) return 0; @@ -2004,8 +2011,8 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break; /* XXX shouldn't do this with commit/undo. */ rc = 0; if (fsm->stage == FSM_PROCESS) rc = fsmNext(fsm, FSM_UNLINK); - if (rc == 0) rc = CPIOERR_LSTAT_FAILED; - return (rc ? rc : CPIOERR_LSTAT_FAILED); /* XXX HACK */ + if (rc == 0) rc = CPIOERR_ENOENT; + return (rc ? rc : CPIOERR_ENOENT); /* XXX HACK */ /*@notreached@*/ break; case FSM_UNLINK: @@ -2013,7 +2020,8 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break; if (_fsm_debug && (stage & FSM_SYSCALL)) rpmMessage(RPMMESS_DEBUG, " %8s (%s) %s\n", cur, fsm->path, (rc < 0 ? strerror(errno) : "")); - if (rc < 0) rc = CPIOERR_UNLINK_FAILED; + if (rc < 0) + rc = (errno == ENOENT ? CPIOERR_ENOENT : CPIOERR_UNLINK_FAILED); break; case FSM_RENAME: rc = Rename(fsm->opath, fsm->path); @@ -2047,7 +2055,12 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break; if (_fsm_debug && (stage & FSM_SYSCALL)) rpmMessage(RPMMESS_DEBUG, " %8s (%s) %s\n", cur, fsm->path, (rc < 0 ? strerror(errno) : "")); - if (rc < 0) rc = CPIOERR_RMDIR_FAILED; + if (rc < 0) + switch (errno) { + case ENOENT: rc = CPIOERR_ENOENT; break; + case ENOTEMPTY: rc = CPIOERR_ENOTEMPTY; break; + default: rc = CPIOERR_RMDIR_FAILED; break; + } break; case FSM_CHOWN: rc = chown(fsm->path, st->st_uid, st->st_gid); @@ -2125,14 +2138,16 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break; if (_fsm_debug && (stage & FSM_SYSCALL) && rc && errno != ENOENT) rpmMessage(RPMMESS_DEBUG, " %8s (%s, ost) %s\n", cur, fsm->path, (rc < 0 ? strerror(errno) : "")); - if (rc < 0) rc = CPIOERR_LSTAT_FAILED; + if (rc < 0) + rc = (errno == ENOENT ? CPIOERR_ENOENT : CPIOERR_LSTAT_FAILED); break; case FSM_STAT: rc = Stat(fsm->path, ost); if (_fsm_debug && (stage & FSM_SYSCALL) && rc && errno != ENOENT) rpmMessage(RPMMESS_DEBUG, " %8s (%s, ost) %s\n", cur, fsm->path, (rc < 0 ? strerror(errno) : "")); - if (rc < 0) rc = CPIOERR_STAT_FAILED; + if (rc < 0) + rc = (errno == ENOENT ? CPIOERR_ENOENT : CPIOERR_STAT_FAILED); break; case FSM_READLINK: /* XXX NUL terminated result in fsm->rdbuf, len in fsm->rdnb. */ @@ -2155,7 +2170,7 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break; break; case FSM_NEXT: - rc = fsmNext(fsm, FSM_HREAD); + rc = fsmUNSAFE(fsm, FSM_HREAD); if (rc) break; if (!strcmp(fsm->path, CPIO_TRAILER)) { /* Detect end-of-payload. */ fsm->path = _free(fsm->path); |