[Aptitude-svn-commit] r4294 - in branches/aptitude-0.3/aptitude: . doc/en src src/generic/apt

Daniel Burrows dburrows at costa.debian.org
Mon Sep 26 20:59:08 UTC 2005


Author: dburrows
Date: Mon Sep 26 20:59:04 2005
New Revision: 4294

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/doc/en/aptitude.xml
   branches/aptitude-0.3/aptitude/doc/en/manpage.xml
   branches/aptitude-0.3/aptitude/src/generic/apt/apt.cc
   branches/aptitude-0.3/aptitude/src/main.cc
Log:
Always open the cache in read-only mode regardless of whether the user is root or not if -s is given on the command-line.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Mon Sep 26 20:59:04 2005
@@ -1,5 +1,11 @@
 2005-09-26  Daniel Burrows  <dburrows at debian.org>
 
+	* doc/en/aptitude.xml, doc/en/manpage.xml, src/generic/apt/apt.cc, src/main.cc:
+
+	  Change Aptitude::Cmdline::Simulate to Aptitude::Simulate; if it
+	  is true, always open the cache in read-only mode regardless of
+	  whether the user is root or not.  This really Closes: #243192.
+
 	* src/download.cc:
 
 	  Write the date stamps for aptitude logs in RFC2822 format;

Modified: branches/aptitude-0.3/aptitude/doc/en/aptitude.xml
==============================================================================
--- branches/aptitude-0.3/aptitude/doc/en/aptitude.xml	(original)
+++ branches/aptitude-0.3/aptitude/doc/en/aptitude.xml	Mon Sep 26 20:59:04 2005
@@ -7784,10 +7784,15 @@
 	      <seg><literal>Aptitude::CmdLine::Simulate</literal></seg>
 	      <seg><literal>false</literal></seg>
 	      <seg>
-		In command-line mode, causes &aptitude; to just
-		display the actions that would be performed
-		(rather than actually performing them).  This is
-		equivalent to the <literal>-s</literal>
+		<emphasis>This option is deprecated; use
+		<literal><link
+		linkend='configSimulate'>Aptitude::Simulate</link></literal>
+		instead.</emphasis> In command-line mode, causes
+		&aptitude; to just display the actions that would be
+		performed (rather than actually performing them); in
+		the visual interface, causes the program to start in
+		read-only mode regardless of whether you are &root; or
+		not.  This is equivalent to the <literal>-s</literal>
 		command-line option.
 	      </seg>
 	    </seglistitem>
@@ -8181,6 +8186,20 @@
 	      </seg>
 	    </seglistitem>
 
+	    <seglistitem id='configSimulate'>
+	      <seg><literal>Aptitude::Simulate</literal></seg>
+	      <seg><literal>false</literal></seg>
+	      <seg>
+		In command-line mode, causes &aptitude; to just
+		display the actions that would be performed (rather
+		than actually performing them); in the visual
+		interface, causes the program to start in read-only
+		mode regardless of whether you are &root; or not.
+		This is equivalent to the <literal>-s</literal>
+		command-line option.
+	      </seg>
+	    </seglistitem>
+
 	    <seglistitem id='configSuggests-Important'>
 	      <seg><literal>Aptitude::Suggests-Important</literal></seg>
 

Modified: branches/aptitude-0.3/aptitude/doc/en/manpage.xml
==============================================================================
--- branches/aptitude-0.3/aptitude/doc/en/manpage.xml	(original)
+++ branches/aptitude-0.3/aptitude/doc/en/manpage.xml	Mon Sep 26 20:59:04 2005
@@ -738,14 +738,16 @@
 
 	<listitem>
 	  <para>
-	    Print the actions that would normally be performed,
-	    but don't actually perform them.  This does not
-	    require &root; privileges.
+	    In command-line mode, print the actions that would
+	    normally be performed, but don't actually perform them.
+	    This does not require &root; privileges.  In the visual
+	    interface, always open the cache in read-only mode
+	    regardless of whether you are &root;.
 	  </para>
 
 	  <para>
 	    This corresponds to the configuration option <literal><link
-	    linkend='configCmdLine-Simulate'>Aptitude::CmdLine::Simulate</link></literal>.
+	    linkend='configSimulate'>Aptitude::Simulate</link></literal>.
 	  </para>
 	</listitem>
       </varlistentry>

Modified: branches/aptitude-0.3/aptitude/src/generic/apt/apt.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/apt/apt.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/generic/apt/apt.cc	Mon Sep 26 20:59:04 2005
@@ -246,11 +246,14 @@
   apt_source_list=new pkgSourceList;
   apt_source_list->ReadMainList();
 
+  bool simulate = aptcfg->FindB(PACKAGE "::Simulate", false);
+
   bool open_failed=!new_file->Open(*progress_bar, do_initselections,
-				   (getuid()==0), status_fname)
+				   (getuid() == 0) && !simulate,
+				   status_fname)
     || _error->PendingError();
 
-  if(open_failed && getuid()==0)
+  if(open_failed && getuid() == 0)
     {
       // Don't discard errors, make sure they get displayed instead.
       consume_errors();

Modified: branches/aptitude-0.3/aptitude/src/main.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/main.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/main.cc	Mon Sep 26 20:59:04 2005
@@ -209,7 +209,8 @@
   string display_format=aptcfg->Find(PACKAGE "::CmdLine::Package-Display-Format", "%c%a%M %p# - %d#");
   string sort_policy="name";
   string width=aptcfg->Find(PACKAGE "::CmdLine::Package-Display-Width", "");
-  bool simulate=aptcfg->FindB(PACKAGE "::CmdLine::Simulate", false);
+  bool simulate = aptcfg->FindB(PACKAGE "::CmdLine::Simulate", false) ||
+    aptcfg->FindB(PACKAGE "::Simulate", false);
   bool download_only=aptcfg->FindB(PACKAGE "::CmdLine::Download-Only", false);;
 
   bool update_only=false, install_only=false, queue_only=false;
@@ -350,6 +351,9 @@
   else if(seen_quiet)
     aptcfg->SetNoUser("quiet", quiet);
 
+  if(simulate)
+    aptcfg->SetNoUser(PACKAGE "::Simulate", true);
+
   // Sanity-check
   if(update_only && install_only)
     {
@@ -476,13 +480,6 @@
 	}
     }
 
-  if(simulate)
-    {
-      fprintf(stderr, _("Warning: the visual interface will ignore -s/Cmdline::Simulate\n"));
-      usage();
-      exit(1);
-    }
-  
   ui_init();
 
   try



More information about the Aptitude-svn-commit mailing list