diff -ru apt-0.6.45ubuntu14-orig/apt-pkg/depcache.cc apt-0.6.45ubuntu14/apt-pkg/depcache.cc --- apt-0.6.45ubuntu14-orig/apt-pkg/depcache.cc 2006-09-21 02:02:38.000000000 +0200 +++ apt-0.6.45ubuntu14/apt-pkg/depcache.cc 2006-11-17 12:46:04.000000000 +0100 @@ -26,6 +26,8 @@ #include #include +#include + #include pkgDepCache::ActionGroup::ActionGroup(pkgDepCache &cache) : @@ -191,6 +193,7 @@ if(!FileExists(state)) { StateFile.Open(state, FileFd::WriteEmpty); + (void) fchmod(StateFile.Fd(), EXTENDED_STATES_PERM); StateFile.Close(); } @@ -254,6 +257,11 @@ fprintf(OutFile,"\n"); } } + fflush(OutFile); + if (ferror(OutFile)) + return _error->Error(_("Failed to write temporary StateFile %s"), + outfile.c_str()); + fchmod(fileno(OutFile), EXTENDED_STATES_PERM); fclose(OutFile); // move the outfile over the real file diff -ru apt-0.6.45ubuntu14-orig/apt-pkg/depcache.h apt-0.6.45ubuntu14/apt-pkg/depcache.h --- apt-0.6.45ubuntu14-orig/apt-pkg/depcache.h 2006-09-20 10:45:16.000000000 +0200 +++ apt-0.6.45ubuntu14/apt-pkg/depcache.h 2006-11-17 12:35:41.000000000 +0100 @@ -49,6 +49,8 @@ #include +#define EXTENDED_STATES_PERM 0644 + class pkgDepCache : protected pkgCache::Namespace { public: diff -ru apt-0.6.45ubuntu14-orig/cmdline/apt-mark apt-0.6.45ubuntu14/cmdline/apt-mark --- apt-0.6.45ubuntu14-orig/cmdline/apt-mark 2006-07-03 18:51:16.000000000 +0200 +++ apt-0.6.45ubuntu14/cmdline/apt-mark 2006-11-17 12:53:37.000000000 +0100 @@ -59,5 +59,6 @@ outfile.write(newsec+"\n") else: outfile.write(str(tagfile.Section)+"\n") - # all done, rename the tmpfile + # all done, rename the tmpfile && set permissions os.rename(outfile.name, STATE_FILE) + os.chmod(outfile.name, 0644)