Package: reprepro Version: 4.14.1-1 Severity: normal Tags: patch Hi,
The generated suite that is written to the "Suite" field in the Release file of a snapshot is constructed using the codename of a distribution. This is misleading because it mixes codename and suites. The "Suite" field should be based on the distribution's suite and the snapshot name. This is also true for the "Codename" field that is simply copied from the distribution a snapshot is based upon. Despite the comment in code, as of apt 0.9.16.1 the generated fake codename doesn't suppress the apt warning about not matching fields in Release and sources.list until #644610 is fixed. Regards, Lukas
From: Lukas Anzinger <[email protected]> Date: Fri, 21 Mar 2014 13:09:50 +0100 Subject: Generated "Suite" field of a snapshot should be based on suite not codename. The generated suite that is written to the "Suite" field in the Release file of a snapshot was constructed using the codename of a distribution. This is misleading because it mixes codename and suites. The "Suite" field should be based on the distribution's suite and the snapshot name. This is also true for the "Codename" field that was simply copied from the distribution a snapshot is based upon. Despite the comment in code, as of apt 0.9.16.1 the generated fake codename doesn't suppress the apt warning about not matching fields in Release and sources.list until #644610 is fixed. --- distribution.c | 3 ++- release.c | 20 ++++++++++++++------ release.h | 2 +- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/distribution.c b/distribution.c index 6db17da..2d6cdb5 100644 --- a/distribution.c +++ b/distribution.c @@ -738,7 +738,8 @@ retvalue distribution_snapshot(struct distribution *distribution, const char *na assert (distribution != NULL); - r = release_initsnapshot(distribution->codename, name, &release); + r = release_initsnapshot(distribution->codename, distribution->suite, + name, &release); if (RET_WAS_ERROR(r)) return r; diff --git a/release.c b/release.c index 1ebf2bc..4893447 100644 --- a/release.c +++ b/release.c @@ -224,7 +224,7 @@ retvalue release_init(struct release **release, const char *codename, const char return RET_OK; } -retvalue release_initsnapshot(const char *codename, const char *name, struct release **release) { +retvalue release_initsnapshot(const char *codename, const char *suite, const char *name, struct release **release) { struct release *n; n = zNEW(struct release); @@ -235,20 +235,28 @@ retvalue release_initsnapshot(const char *codename, const char *name, struct rel free(n); return RET_ERROR_OOM; } - /* apt only removes the last /... part but we create two, - * so stop it generating warnings by faking a suite */ - n->fakesuite = mprintf("%s/snapshots/%s", codename, name); - if (FAILEDTOALLOC(n->fakesuite)) { + n->fakecodename = mprintf("%s/snapshots/%s", codename, name); + if (FAILEDTOALLOC(n->fakecodename)) { free(n->dirofdist); free(n); return RET_ERROR_OOM; } - n->fakecodename = NULL; + n->fakesuite = NULL; + if (suite != NULL) { + n->fakesuite = mprintf("%s/snapshots/%s", suite, name); + if (FAILEDTOALLOC(n->fakesuite)) { + free(n->fakecodename); + free(n->dirofdist); + free(n); + return RET_ERROR_OOM; + } + } n->fakecomponentprefix = NULL; n->fakecomponentprefixlen = 0; n->cachedb = NULL; n->snapshotname = strdup(name); if (n->snapshotname == NULL) { + free(n->fakecodename); free(n->fakesuite); free(n->dirofdist); free(n); diff --git a/release.h b/release.h index a0f10c5..11eb887 100644 --- a/release.h +++ b/release.h @@ -27,7 +27,7 @@ typedef unsigned int compressionset; /* 1 << indexcompression */ /* Initialize Release generation */ retvalue release_init(struct release **, const char * /*codename*/, /*@null@*/const char * /*suite*/, /*@null@*/const char * /*fakeprefix*/); /* same but for a snapshot */ -retvalue release_initsnapshot(const char *codename, const char *name, struct release **); +retvalue release_initsnapshot(const char *codename, const char *suite, const char *name, struct release **); retvalue release_mkdir(struct release *, const char * /*relativedirectory*/);

