[MacPorts] #62606: Strange "ports diag" complaint wrt ghc-8.10.4

MacPorts noreply at macports.org
Mon Apr 5 01:36:38 UTC 2021


#62606: Strange "ports diag" complaint wrt ghc-8.10.4
------------------------------+--------------------
  Reporter:  GussyFinkNottle  |      Owner:  (none)
      Type:  defect           |     Status:  new
  Priority:  Normal           |  Milestone:
 Component:  ports            |    Version:  2.6.4
Resolution:                   |   Keywords:
      Port:  ghc              |
------------------------------+--------------------
Changes (by ryandesign):

 * cc: ryandesign (added)


Comment:

 Replying to [comment:5 GussyFinkNottle]:
 > The command you suggested currently returns "0". Macports still refuses
 to deactivate (a fortiori uninstall) ghc.
 > Last night I made some very ill-advised changes to registry.db via SQL,
 and suspect I may now have to reinstall macports from scratch.
 > However it seems to work fine, except where ghc is concerned. I can
 still list my requested and installed ports, upgrade outdated ports, etc.
 >
 > Before my ill-advised changes, I used sqlite3's .dump command to make a
 text file "tmp2", in which grep Week.p_hi returns:
 >
 > {{{
 > INSERT INTO files
 VALUES(1257,'/opt/local/lib/ghc-8.10.4/time-1.9.3/Data/Time/Calendar/Week.p_hi','/opt/local/lib/ghc-8.10.4/time-1*9.3/Data/Time/Calendar/Week.p_hi',1,0);
 > }}}

 Ah ok. I see now that the files table records each file's path twice: the
 first in "path" which is where the port wants to install the file, and a
 second time in "actual_path" which is where MacPorts (thinks it) actually
 installed the file. I told you to modify the "path" when I should have
 told you to modify the "actual_path".


 > After my ill-advised changes, I used produced a text file "tmp3", which
 differs from tmp2 as follows:
 >
 > {{{
 > > INSERT INTO files
 VALUES(1257,'/opt/local/lib/ghc-8.10.4/time-1.9.3/Data/Time/Calendar/Week.p_hi','/opt/local/lib/ghc-8.10.4/time-1.9.3/Data/Time/Calendar/Week.p_hi',1,0);
 > }}}
 >
 > grep Week.p_hi tmp2 tmp3 returns:
 >
 > {{{
 > tmp2:INSERT INTO files
 VALUES(1257,'/opt/local/lib/ghc-8.10.4/time-1.9.3/Data/Time/Calendar/Week.p_hi','/opt/local/lib/ghc-8.10.4/time-1*9.3/Data/Time/Calendar/Week.p_hi',1,0);
 > tmp3:INSERT INTO files
 VALUES(1257,'/opt/local/lib/ghc-8.10.4/time-1.9.3/Data/Time/Calendar/Week.p_hi','/opt/local/lib/ghc-8.10.4/time-1*9.3/Data/Time/Calendar/Week.p_hi',1,0);
 > tmp3:INSERT INTO files
 VALUES(1257,'/opt/local/lib/ghc-8.10.4/time-1.9.3/Data/Time/Calendar/Week.p_hi','/opt/local/lib/ghc-8.10.4/time-1.9.3/Data/Time/Calendar/Week.p_hi',1,0);
 > }}}
 > (I was trying to insert the correct row into the files table. Needless
 to say, I've little experience with SQL.)

 Ok, so you've inserted a duplicate row for the Week.p_hi file. The fix may
 then be to remove the remaining erroneous row:

 {{{
 sudo sqlite3 /opt/local/var/macports/registry/registry.db 'delete from
 files where
 actual_path="/opt/local/lib/ghc-8.10.4/time-1*9.3/Data/Time/Calendar/Week.p_hi";'
 'select changes();'
 }}}

 However since you have subsequently uninstalled the port, I suspect that
 this entry has already been deleted and that this will print 0 (for 0 rows
 affected).


 > When things didn't work out, I ran: sudo  sqlite3
 /opt/local/var/macports/registry/registry.db "PRAGMA integrity_check"
 > This produced (as hinted at from your remark about "custom collation"):
 >
 > {{{
 > Error: no such collation sequence: VERSION
 > }}}

 Glad to hear that you found the `.load macports.sqlext` command to
 overcome this, presuming that you had installed the extension using `sudo
 port install macports.sqlext`.


 > Now I wonder:
 > 1. reinstate a previous state of registry.db from a time-machine backup,
 cross my fingers, and try to upgrade what then seems to be outdated.

 If your backed-up registry.db matches your installed ports -- that is, you
 did not install, upgrade, uninstall or otherwise change any installed
 ports after taking the backup, and MacPorts was not doing anything at any
 time during the backup -- then you could restore the backup copy of the
 registry. But otherwise I would not attempt to do this because what's
 recorded in the backup registry would not match what is actually
 installed.


 > 2. follow the instructions to reinstall macports from scratch.
 Worryingly, the first step seems to be to uninstall all ports. The odds
 are that ghc will be hard to uninstall.

 Yes, the first recommended step when completely uninstalling is to have
 MacPorts uninstall all ports. The given command will proceed (`-p`) past
 any errors encountered, such as being unable to uninstall some ports. As
 it says, "you can proceed on to the next steps" despite any errors, with
 the understanding that if the ports that could not be uninstalled put
 files in nonstandard places, then they will not be removed by the
 subsequent instructions. ghc does not put files in nonstandard locations,
 so this is not a concern.


 Replying to [comment:6 GussyFinkNottle]:
 > I have now managed to uninstall ghc, by ".load macports.sqlext", and
 reindexing file_actual.
 > (Some errors from "pragma integrity_check" (below) still remain.
 However, ghc could then be deactivated
 > and uninstalled.)
 >
 > The errors that remain are;
 >
 > {{{
 > row 11786 missing from index file_path
 > wrong # of entries in index file_actual_nocase
 > }}}

 I am not really familiar with indexes in sqlite, but since you already
 found the command for recreating the table's file_actual index, and since
 that's not one of the indexes it's complaining about, maybe you should use
 the same command to recreate the table's file_path and file_actual_nocase
 indexes as well.


 > (By the way, having uninstalled ghc, I cannot *re*install it. But that's
 another story.)

 Agreed, and filing a separate bug report about that (presuming that none
 of the existing bug reports cover your issue) would be clearer.

-- 
Ticket URL: <https://trac.macports.org/ticket/62606#comment:7>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list