Bug#132776: apt-extracttemplates should prefix temp filenames with the package name
As this bug report points out it can be a little confusing to tell what
package /tmp/config.XXXXX comes from when it outputs stuff to stderr.
The easiest fix is to make apt-extracttemplates name the file like
/tmp/package.config.XXXXXX (and /tmp/package.templates.XXXXX for
consistency). Something like this?
--- cmdline/apt-extracttemplates.cc.old Thu Feb 7 13:02:59 2002
+++ cmdline/apt-extracttemplates.cc Thu Feb 7 13:02:19 2002
@@ -242,11 +242,11 @@
// WriteFile - write the contents of the passed string to a file /*{{{*/
// ---------------------------------------------------------------------
/* */
-string WriteFile(const char *prefix, const char *data)
+string WriteFile(const char *package, const char *prefix, const char *data)
{
char fn[512];
static int i;
- snprintf(fn, sizeof(fn), "%s/%s.%u%d", _config->Find("APT::ExtractTemplates::TempDir", TMPDIR).c_str(), prefix, getpid(), i++);
+ snprintf(fn, sizeof(fn), "%s/%s.%s.%u%d", _config->Find("APT::ExtractTemplates::TempDir", TMPDIR).c_str(), package, prefix, getpid(), i++);
FileFd f;
if (data == NULL)
data = "";
@@ -267,8 +267,8 @@
/* */
void WriteConfig(const DebFile &file)
{
- string templatefile = WriteFile("template", file.Template);
- string configscript = WriteFile("config", file.Config);
+ string templatefile = WriteFile(file.Package, "template", file.Template);
+ string configscript = WriteFile(file.Package, "config", file.Config);
if (templatefile.empty() == true || configscript.empty() == true)
return;
--- doc/apt-extracttemplates.1.sgml.old Thu Feb 7 13:04:28 2002
+++ doc/apt-extracttemplates.1.sgml Thu Feb 7 13:04:13 2002
@@ -42,8 +42,8 @@
<para>
template-file and config-script are written to the temporary directory
specified by the -t or --tempdir (<literal/APT::ExtractTemplates::TempDir/>)
- directory, with filenames of the form <filename>template.XXXX</> and
- <filename>config.XXXX</>
+ directory, with filenames of the form <filename>package.template.XXXX</> and
+ <filename>package.config.XXXX</>
</RefSect1>
<RefSect1><Title>Options</>
--
see shy jo
Reply to: