- fix: wrong package count for trigger scriptlet 1st arg (#100509).
- fix: don't break header SHA1 if non-existent user/group (#97727). - remove fuids/fgids from rpmfi, easier to lookup fuser/fgroup instead. - merge sensible parts of openpkg rpm.patch.bugfix (#104780). CVS patchset: 7024 CVS date: 2003/12/27 01:37:56
This commit is contained in:
parent
e21b054fbc
commit
59f6e1d78f
4
CHANGES
4
CHANGES
|
@ -23,6 +23,10 @@
|
|||
- convert ja and ko man pages to utf8 (#106050).
|
||||
- man page corrections (#106415).
|
||||
- perl.req typo (#106672).
|
||||
- fix: wrong package count for trigger scriptlet 1st arg (#100509).
|
||||
- fix: don't break header SHA1 if non-existent user/group (#97727).
|
||||
- remove fuids/fgids from rpmfi, easier to lookup fuser/fgroup instead.
|
||||
- merge sensible parts of openpkg rpm.patch.bugfix (#104780).
|
||||
|
||||
4.2 -> 4.2.1:
|
||||
- fix: nested %if handling, optind initialization posix vs. glibc.
|
||||
|
|
|
@ -1379,9 +1379,7 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl,
|
|||
fi->astriplen = strlen(fl->buildRootURL);
|
||||
fi->striplen = 0;
|
||||
fi->fuser = NULL;
|
||||
fi->fuids = xcalloc(sizeof(*fi->fuids), fi->fc);
|
||||
fi->fgroup = NULL;
|
||||
fi->fgids = xcalloc(sizeof(*fi->fgids), fi->fc);
|
||||
|
||||
/* Make the cpio list */
|
||||
if (fi->dil != NULL) /* XXX can't happen */
|
||||
|
@ -1430,10 +1428,6 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl,
|
|||
continue;
|
||||
}
|
||||
fi->actions[i] = FA_COPYOUT;
|
||||
fi->fuids[i] = getUidS(flp->uname);
|
||||
fi->fgids[i] = getGidS(flp->gname);
|
||||
if (fi->fuids[i] == (uid_t)-1) fi->fuids[i] = 0;
|
||||
if (fi->fgids[i] == (gid_t)-1) fi->fgids[i] = 0;
|
||||
fi->fmapflags[i] = CPIO_MAP_PATH |
|
||||
CPIO_MAP_TYPE | CPIO_MAP_MODE | CPIO_MAP_UID | CPIO_MAP_GID;
|
||||
if (isSrc)
|
||||
|
|
|
@ -1239,7 +1239,6 @@ AC_OUTPUT([ Doxyfile Makefile rpmrc macros platform rpmpopt rpm.spec
|
|||
python/rpmdb/Makefile
|
||||
python/rpmdb/test/Makefile
|
||||
], [ echo timestamp > popt/stamp-h.in
|
||||
echo timestamp > beecrypt/stamp-h.in
|
||||
echo timestamp > stamp-h.in
|
||||
]
|
||||
)
|
||||
|
|
35
lib/fsm.c
35
lib/fsm.c
|
@ -753,18 +753,25 @@ int fsmMapAttrs(FSM_t fsm)
|
|||
int i = fsm->ix;
|
||||
|
||||
if (fi && i >= 0 && i < fi->fc) {
|
||||
mode_t perms =
|
||||
(S_ISDIR(st->st_mode) ? fi->dperms : fi->fperms);
|
||||
mode_t finalMode =
|
||||
(fi->fmodes ? fi->fmodes[i] : perms);
|
||||
uid_t finalUid =
|
||||
(fi->fuids ? fi->fuids[i] : fi->uid); /* XXX chmod u-s */
|
||||
gid_t finalGid =
|
||||
(fi->fgids ? fi->fgids[i] : fi->gid); /* XXX chmod g-s */
|
||||
dev_t finalRdev =
|
||||
(fi->frdevs ? fi->frdevs[i] : 0);
|
||||
int_32 finalMtime =
|
||||
(fi->fmtimes ? fi->fmtimes[i] : 0);
|
||||
mode_t perms = (S_ISDIR(st->st_mode) ? fi->dperms : fi->fperms);
|
||||
mode_t finalMode = (fi->fmodes ? fi->fmodes[i] : perms);
|
||||
dev_t finalRdev = (fi->frdevs ? fi->frdevs[i] : 0);
|
||||
int_32 finalMtime = (fi->fmtimes ? fi->fmtimes[i] : 0);
|
||||
uid_t uid = fi->uid;
|
||||
gid_t gid = fi->gid;
|
||||
|
||||
if (fi->fuser && unameToUid(fi->fuser[i], &uid)) {
|
||||
rpmMessage(RPMMESS_WARNING,
|
||||
_("user %s does not exist - using root\n"), fi->fuser[i]);
|
||||
uid = 0;
|
||||
finalMode &= ~S_ISUID; /* turn off suid bit */
|
||||
}
|
||||
|
||||
if (fi->fgroup && gnameToGid(fi->fgroup[i], &gid)) {
|
||||
rpmMessage(RPMMESS_WARNING,
|
||||
_("group %s does not exist - using root\n"), fi->fgroup[i]);
|
||||
finalMode &= ~S_ISGID; /* turn off sgid bit */
|
||||
}
|
||||
|
||||
if (fsm->mapFlags & CPIO_MAP_MODE)
|
||||
st->st_mode = (st->st_mode & S_IFMT) | (finalMode & ~S_IFMT);
|
||||
|
@ -777,9 +784,9 @@ int fsmMapAttrs(FSM_t fsm)
|
|||
st->st_mtime = finalMtime;
|
||||
}
|
||||
if (fsm->mapFlags & CPIO_MAP_UID)
|
||||
st->st_uid = finalUid;
|
||||
st->st_uid = uid;
|
||||
if (fsm->mapFlags & CPIO_MAP_GID)
|
||||
st->st_gid = finalGid;
|
||||
st->st_gid = gid;
|
||||
|
||||
{ rpmts ts = fsmGetTs(fsm);
|
||||
|
||||
|
|
57
lib/psm.c
57
lib/psm.c
|
@ -321,13 +321,6 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
|
|||
fi->astriplen = 0;
|
||||
fi->striplen = 0;
|
||||
|
||||
fi->fuids = xcalloc(sizeof(*fi->fuids), fi->fc);
|
||||
fi->fgids = xcalloc(sizeof(*fi->fgids), fi->fc);
|
||||
for (i = 0; i < fi->fc; i++) {
|
||||
fi->fuids[i] = fi->uid;
|
||||
fi->fgids[i] = fi->gid;
|
||||
}
|
||||
|
||||
for (i = 0; i < fi->fc; i++)
|
||||
fi->actions[i] = FA_CREATE;
|
||||
|
||||
|
@ -684,12 +677,12 @@ static rpmRC runScript(rpmpsm psm, Header h, const char * sln,
|
|||
if (ofdno != STDOUT_FILENO)
|
||||
xx = dup2(ofdno, STDOUT_FILENO);
|
||||
/* make sure we don't close stdin/stderr/stdout by mistake! */
|
||||
if (ofdno > STDERR_FILENO && ofdno != sfdno) {
|
||||
if (ofdno > STDERR_FILENO && ofdno != sfdno)
|
||||
xx = Fclose (out);
|
||||
}
|
||||
if (sfdno > STDERR_FILENO) {
|
||||
if (sfdno > STDERR_FILENO)
|
||||
xx = Fclose (scriptFd);
|
||||
}
|
||||
else
|
||||
xx = Fclose(out);
|
||||
}
|
||||
|
||||
{ const char *ipath = rpmExpand("PATH=%{_install_script_path}", NULL);
|
||||
|
@ -854,11 +847,13 @@ static rpmRC handleOneTrigger(const rpmpsm psm,
|
|||
const char ** triggerProgs;
|
||||
int_32 * triggerIndices;
|
||||
const char * sourceName;
|
||||
const char * triggerName;
|
||||
rpmRC rc = RPMRC_OK;
|
||||
int xx;
|
||||
int i;
|
||||
|
||||
xx = headerNVR(sourceH, &sourceName, NULL, NULL);
|
||||
xx = headerNVR(triggeredH, &triggerName, NULL, NULL);
|
||||
|
||||
trigger = rpmdsInit(rpmdsNew(triggeredH, RPMTAG_TRIGGERNAME, scareMem));
|
||||
if (trigger == NULL)
|
||||
|
@ -897,7 +892,7 @@ static rpmRC handleOneTrigger(const rpmpsm psm,
|
|||
{ int arg1;
|
||||
int index;
|
||||
|
||||
arg1 = rpmdbCountPackages(rpmtsGetRdb(ts), Name);
|
||||
arg1 = rpmdbCountPackages(rpmtsGetRdb(ts), triggerName);
|
||||
if (arg1 < 0) {
|
||||
/* XXX W2DO? fails as "execution of script failed" */
|
||||
rc = RPMRC_FAIL;
|
||||
|
@ -1263,10 +1258,6 @@ assert(psm->mi == NULL);
|
|||
if (fi->fgroup == NULL)
|
||||
xx = hge(fi->h, RPMTAG_FILEGROUPNAME, NULL,
|
||||
(void **) &fi->fgroup, NULL);
|
||||
if (fi->fuids == NULL)
|
||||
fi->fuids = xcalloc(sizeof(*fi->fuids), fc);
|
||||
if (fi->fgids == NULL)
|
||||
fi->fgids = xcalloc(sizeof(*fi->fgids), fc);
|
||||
rc = RPMRC_OK;
|
||||
}
|
||||
if (psm->goal == PSM_PKGERASE || psm->goal == PSM_PKGSAVE) {
|
||||
|
@ -1473,34 +1464,6 @@ psm->te->h = headerLink(fi->h);
|
|||
break;
|
||||
}
|
||||
|
||||
(void) rpmfiInit(fi, 0);
|
||||
while ((i = rpmfiNext(fi)) >= 0) {
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
|
||||
uid = fi->uid;
|
||||
gid = fi->gid;
|
||||
if (fi->fuser && unameToUid(fi->fuser[i], &uid)) {
|
||||
rpmMessage(RPMMESS_WARNING,
|
||||
_("user %s does not exist - using root\n"),
|
||||
fi->fuser[i]);
|
||||
uid = 0;
|
||||
/* XXX this diddles header memory. */
|
||||
fi->fmodes[i] &= ~S_ISUID; /* turn off the suid bit */
|
||||
}
|
||||
|
||||
if (fi->fgroup && gnameToGid(fi->fgroup[i], &gid)) {
|
||||
rpmMessage(RPMMESS_WARNING,
|
||||
_("group %s does not exist - using root\n"),
|
||||
fi->fgroup[i]);
|
||||
gid = 0;
|
||||
/* XXX this diddles header memory. */
|
||||
fi->fmodes[i] &= ~S_ISGID; /* turn off the sgid bit */
|
||||
}
|
||||
if (fi->fuids) fi->fuids[i] = uid;
|
||||
if (fi->fgids) fi->fgids[i] = gid;
|
||||
}
|
||||
|
||||
/* Retrieve type of payload compression. */
|
||||
rc = rpmpsmNext(psm, PSM_RPMIO_FLAGS);
|
||||
|
||||
|
@ -1759,8 +1722,6 @@ psm->te->h = headerFree(psm->te->h);
|
|||
psm->rpmio_flags = _free(psm->rpmio_flags);
|
||||
psm->failedFile = _free(psm->failedFile);
|
||||
|
||||
fi->fgids = _free(fi->fgids);
|
||||
fi->fuids = _free(fi->fuids);
|
||||
fi->fgroup = hfd(fi->fgroup, -1);
|
||||
fi->fuser = hfd(fi->fuser, -1);
|
||||
fi->apath = _free(fi->apath);
|
||||
|
@ -1805,7 +1766,9 @@ psm->te->h = headerFree(psm->te->h);
|
|||
case PSM_CHROOT_IN:
|
||||
{ const char * rootDir = rpmtsRootDir(ts);
|
||||
/* Change root directory if requested and not already done. */
|
||||
if (rootDir != NULL && !rpmtsChrootDone(ts) && !psm->chrootDone) {
|
||||
if (rootDir != NULL && !(rootDir[0] == '/' && rootDir[1] == '\0')
|
||||
&& !rpmtsChrootDone(ts) && !psm->chrootDone)
|
||||
{
|
||||
static int _loaded = 0;
|
||||
|
||||
/*
|
||||
|
|
|
@ -1113,9 +1113,7 @@ fprintf(stderr, "*** fi %p\t%s[%d]\n", fi, fi->Type, fi->fc);
|
|||
fi->cdict = hfd(fi->cdict, -1);
|
||||
|
||||
fi->fuser = hfd(fi->fuser, -1);
|
||||
fi->fuids = _free(fi->fuids);
|
||||
fi->fgroup = hfd(fi->fgroup, -1);
|
||||
fi->fgids = _free(fi->fgids);
|
||||
|
||||
fi->fstates = _free(fi->fstates);
|
||||
|
||||
|
@ -1313,9 +1311,7 @@ if (fi->actions == NULL)
|
|||
fi->replacedSizes = xcalloc(fi->fc, sizeof(*fi->replacedSizes));
|
||||
|
||||
xx = hge(h, RPMTAG_FILEUSERNAME, NULL, (void **) &fi->fuser, NULL);
|
||||
fi->fuids = NULL;
|
||||
xx = hge(h, RPMTAG_FILEGROUPNAME, NULL, (void **) &fi->fgroup, NULL);
|
||||
fi->fgids = NULL;
|
||||
|
||||
if (ts != NULL)
|
||||
if (fi != NULL)
|
||||
|
|
|
@ -70,10 +70,6 @@ struct rpmfi_s {
|
|||
const char ** fuser; /*!< File owner(s) (from header) */
|
||||
/*@only@*/ /*@null@*/
|
||||
const char ** fgroup; /*!< File group(s) (from header) */
|
||||
/*@only@*/ /*@null@*/
|
||||
uid_t * fuids; /*!< File uid(s) */
|
||||
/*@only@*/ /*@null@*/
|
||||
gid_t * fgids; /*!< File gid(s) */
|
||||
|
||||
/*@only@*/ /*@null@*/
|
||||
char * fstates; /*!< File state(s) (from header) */
|
||||
|
|
|
@ -880,7 +880,7 @@ freeArgs(MacroBuf mb)
|
|||
*/
|
||||
/*@-bounds@*/
|
||||
/*@dependent@*/ static const char *
|
||||
grabArgs(MacroBuf mb, const MacroEntry me, /*@returned@*/ const char * se, char lastc)
|
||||
grabArgs(MacroBuf mb, const MacroEntry me, /*@returned@*/ const char * se, char *lastc)
|
||||
/*@globals rpmGlobalMacroContext @*/
|
||||
/*@modifies mb, rpmGlobalMacroContext @*/
|
||||
{
|
||||
|
@ -901,7 +901,7 @@ grabArgs(MacroBuf mb, const MacroEntry me, /*@returned@*/ const char * se, char
|
|||
|
||||
/* Copy args into buf until lastc */
|
||||
*be++ = ' ';
|
||||
while ((c = *se++) != '\0' && c != lastc) {
|
||||
while ((c = *se++) != '\0' && (se-1) != lastc) {
|
||||
/*@-globs@*/
|
||||
if (!isblank(c)) {
|
||||
*be++ = c;
|
||||
|
@ -969,6 +969,8 @@ grabArgs(MacroBuf mb, const MacroEntry me, /*@returned@*/ const char * se, char
|
|||
/*@-mods@*/
|
||||
optind = 0; /* XXX but posix != glibc */
|
||||
/*@=mods@*/
|
||||
#else
|
||||
optind = 1;
|
||||
#endif
|
||||
|
||||
opts = me->opts;
|
||||
|
@ -1174,7 +1176,7 @@ expandMacro(MacroBuf mb)
|
|||
int c;
|
||||
int rc = 0;
|
||||
int negate;
|
||||
char grab;
|
||||
char *grab;
|
||||
int chkexist;
|
||||
|
||||
if (++mb->depth > max_macro_depth) {
|
||||
|
@ -1208,7 +1210,7 @@ expandMacro(MacroBuf mb)
|
|||
if (mb->depth > 1) /* XXX full expansion for outermost level */
|
||||
t = mb->t; /* save expansion pointer for printExpand */
|
||||
negate = 0;
|
||||
grab = '\0';
|
||||
grab = NULL;
|
||||
chkexist = 0;
|
||||
switch ((c = *s)) {
|
||||
default: /* %name substitution */
|
||||
|
@ -1243,7 +1245,8 @@ expandMacro(MacroBuf mb)
|
|||
/* For "%name " macros ... */
|
||||
/*@-globs@*/
|
||||
if ((c = *fe) && isblank(c))
|
||||
grab = '\n';
|
||||
if ((grab = strchr(fe,'\n')) == NULL)
|
||||
grab = strchr(fe, '\0');
|
||||
/*@=globs@*/
|
||||
/*@switchbreak@*/ break;
|
||||
case '(': /* %(...) shell escape */
|
||||
|
@ -1290,7 +1293,7 @@ expandMacro(MacroBuf mb)
|
|||
ge = se - 1;
|
||||
/*@innerbreak@*/ break;
|
||||
case ' ':
|
||||
grab = se[-1];
|
||||
grab = se-1;
|
||||
/*@innerbreak@*/ break;
|
||||
default:
|
||||
/*@innerbreak@*/ break;
|
||||
|
@ -1444,7 +1447,7 @@ expandMacro(MacroBuf mb)
|
|||
|
||||
/* Setup args for "%name " macros with opts */
|
||||
if (me && me->opts != NULL) {
|
||||
if (grab != '\0') {
|
||||
if (grab != NULL) {
|
||||
se = grabArgs(mb, me, fe, grab);
|
||||
} else {
|
||||
addMacro(mb->mc, "**", NULL, "", mb->depth);
|
||||
|
|
Loading…
Reference in New Issue