Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 160971

Summary: install-info breaks if /usr/share/info/dir.gz exists
Product: Portage Development Reporter: Ed Catmur <ed>
Component: UnclassifiedAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal Keywords: InVCS
Priority: High    
Version: 2.2   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 147007    
Attachments: info-install-kill-dir.gz.patch

Description Ed Catmur 2007-01-08 19:21:45 UTC
If /usr/share/info/dir.gz exists, install-info will look for it when it doesn't find /usr/share/info/dir.  This causes severe breakage if /usr/share/info/dir.gz is not a valid info file (e.g. empty) as install-info will get confused and not write anything, leading to the classic "info: Cannot find node `Top'."

No idea how /usr/share/info/dir.gz got created, but emerge should rename it to %s.old as with /usr/share/info/dir.

Suggestion:

--- bin/emerge  2007/01/08 19:15:12     1.1
+++ bin/emerge  2007/01/08 19:17:43
@@ -3297,12 +3297,14 @@ def chk_updated_info_files(root, infodir
                        for inforoot in regen_infodirs:
                                if inforoot=='':
                                        continue
-                               try:
-                                       os.rename(inforoot+"/dir",inforoot+"/dir.old")
-                               except SystemExit, e:
-                                       raise # Needed else can't exit
-                               except:
-                                       pass
+                               for suffix in ("", ".gz"):
+                                       try:
+                                               os.rename("%s/dir%s" % (infodir, suffix),
+                                                               "%s/dir%s.old" % (infodir, suffix))
+                                       except SystemExit, e:
+                                               raise # Needed else can't exit
+                                       except:
+                                               pass
 
                                if not os.path.isdir(inforoot):
                                        continue
Comment 1 Ed Catmur 2007-01-08 19:24:33 UTC
Created attachment 106089 [details, diff]
info-install-kill-dir.gz.patch

Above as attachment.
Comment 2 Ed Catmur 2007-01-08 19:46:14 UTC
note, just so you don't have to check the sources:

install-info.c @@ 533: (from sys-apps/texinfo-4.8-r5)
/* Open FILENAME and return the resulting stream pointer.  If it doesn't
   exist, try FILENAME.gz.  If that doesn't exist either, call
   CREATE_CALLBACK (with FILENAME as arg) to create it, if that is
   non-NULL.  If still no luck, fatal error.

   If we do open it, return the actual name of the file opened in
   OPENED_FILENAME and the compress program to use to (de)compress it in
   COMPRESSION_PROGRAM.  The compression program is determined by the
   magic number, not the filename.  */

FILE *
open_possibly_compressed_file (char *filename,
    void (*create_callback) (char *),
    char **opened_filename, char **compression_program, int *is_pipe) 
Comment 3 Zac Medico gentoo-dev 2007-01-09 22:25:30 UTC
Thanks.  This is fixed in svn r5503.
Comment 4 Zac Medico gentoo-dev 2007-01-11 04:15:58 UTC
This has been released in 2.1.2_rc4-r8.