[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#318877: marked as done (udpkg: Avoid error message on first run)

Your message dated Wed, 17 Mar 2010 15:11:10 +0100
with message-id <20100317141110.GG4447@login1.uio.no>
and subject line Re: udpkg: Avoid error message on first run
has caused the Debian Bug report #318877,
regarding udpkg: Avoid error message on first run
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org

318877: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=318877
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: udpkg
Version: 1.01
Tags: patch

If I am not mistaken, udpkg will issue a warning when it is running
for the first time, because the status file is missing.  Here is a
patch to try to create the status file on the first run, and only
report an error if this failed.

I wrote this patch a long time ago, but never found time to test it.
Sending it here to make sure it isn't lost.

Index: status.c
--- status.c	(revisjon 29314)
+++ status.c	(arbeidskopi)
@@ -1,11 +1,16 @@
 /* $Id$ */
 #include "udpkg.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <search.h>
 #include <debian-installer.h>
+#include <error.h>
+#include <errno.h>
 /* Status file handling routines
@@ -210,7 +217,22 @@
 	FILE *f;
 	void *status = 0;
 	struct package_t *m = 0, *p = 0, *t = 0;
+	struct stat statbuf;
+	/* Try to create file if it is missing */
+	if (0 > stat(STATUSFILE, &statbuf) && ENOENT == errno)
+	{
+		f = fopen(STATUSFILE, "w");
+		if (NULL != f)
+			fclose(f);
+		else
+		{
+			error(0, errno, "Unable to create status file %s",
+			      STATUSFILE);
+			return 0;
+		}
+	}
 	if ((f = fopen(STATUSFILE, "r")) == NULL)

--- End Message ---
--- Begin Message ---
I believe the error message from udpkg is no longer printed every time
d-i boots.  I guess the status file now is included as it should.

Happy hacking,
Petter Reinholdtsen

--- End Message ---

Reply to: