Bug 1553810 - ghc-doc-index fails to check before attempting a diff
Summary: ghc-doc-index fails to check before attempting a diff
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: ghc
Version: epel7
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jens Petersen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-03-09 15:16 UTC by R P Herrold
Modified: 2024-07-09 02:19 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2024-07-09 02:19:05 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description R P Herrold 2018-03-09 15:16:33 UTC
Description of problem:

a cron process does not run silently due to insufficient assumption checking

Version-Release number of selected component (if applicable):

ghc-doc-index-7.6.3-26.4

How reproducible:

1. install:  ghc-doc-index
2. fire off: /etc/cron.hourly/ghc-doc-index
3. read the result

Steps to Reproduce:

the diff fails to confirm that one comparand is present and non-null

Actual results:

noise to stderr

Expected results:

a silent process

Additional info:

Comment 1 R P Herrold 2018-03-09 15:22:51 UTC
the test needs to be in file;
     /usr/bin/ghc-doc-index

This line:
     DIR_DIFF=$(diff $PKGDIRCACHE $PKGDIRCACHE.new)

something like

    DIR_DIFF=/dev/null
    [ -s $PKGDIRCACHE -a -s $PKGDIRCACHE.new ] && {
       DIR_DIFF=$(diff $PKGDIRCACHE $PKGDIRCACHE.new)
       }

Comment 2 Jens Petersen 2018-04-12 13:52:31 UTC
Thanks for the report - I wish you had included the noise.

Comment 3 Jens Petersen 2018-04-12 14:02:13 UTC
```
if [ -r "$PKGDIRCACHE" ]; then
  $LISTING */ > $PKGDIRCACHE.new
  DIR_DIFF=$(diff $PKGDIRCACHE $PKGDIRCACHE.new)
else
  $LISTING */ > $PKGDIRCACHE
fi
```

No sure how this can fail?

Comment 4 R P Herrold 2018-04-12 18:11:02 UTC
almost certainly a missing 

     mkdir -p 



[root@centos-7 ~]# grep PKGDIRCACHE /etc/cron.hourly/ghc-doc-index
[root@centos-7 ~]# less /etc/cron.hourly/ghc-doc-index
[root@centos-7 ~]# grep PKGDIRCACHE /usr/bin/ghc-doc-index
PKGDIRCACHE=/var/lib/ghc/pkg-dir.cache
if [ -r "$PKGDIRCACHE" ]; then
  $LISTING */ > $PKGDIRCACHE.new

============

in ghc-doc-index, JUST AFTER:

     PKGDIRCACHE=/var/lib/ghc/pkg-dir.cache

add a backstop check:

     PKGDIR=`dirname ${PKGDIRCACHE}`
     [ ! -d ${PKGDIR} ] && mkdir -p ${PKGDIR}

and it should be fixed

Comment 5 Jens Petersen 2018-04-17 09:10:03 UTC
Hmm I am not sure: /var/lib/ghc/ is owned by ghc-compiler-7.6.3-26.4.el7

https://koji.fedoraproject.org/koji/rpminfo?fileStart=200&rpmID=8405643&fileOrder=name&buildrootOrder=-id&buildrootStart=0#filelist

Comment 6 R P Herrold 2018-04-17 13:48:24 UTC
[herrold@centos-7 ~]$ rpm -qf /var/lib/ghc/
ghc-compiler-7.6.3-26.4.el7.x86_64
 

indeed -- is there a Dependency on that parent, or is that parent properly 'owning' that directory?

Comment 7 R P Herrold 2018-04-17 13:51:22 UTC
that seems like a lot of Dependency to drag in to satisfy a small package

ghc-compiler
Size        : 79646724

ghc-doc-index
Size        : 199

Comment 8 Jens Petersen 2018-10-18 00:35:07 UTC
I think I have improved this in the Fedora and Copr packages.

Basically the little package requires the doc index script in ghc-compiler
and all the docs are currently in devel subpackages which will pull
in the compiler anyway.

Comment 9 Jens Petersen 2018-10-18 00:38:01 UTC
I wonder if it is some permission issue you are seeing?

Comment 10 Troy Dawson 2024-07-09 02:19:05 UTC
EPEL 7 entered end-of-life (EOL) status on 2024-06-30.\n\nEPEL 7 is no longer maintained, which means that it\nwill not receive any further security or bug fix updates.\n As a result we are closing this bug.


Note You need to log in before you can comment on or make changes to this bug.