GNU bug report logs - #68948
highlight error, cannot open filetypes.conf: No such file or directory

Previous Next

Package: guix;

Reported by: chris <chris <at> bumblehead.com>

Date: Tue, 6 Feb 2024 11:04:02 UTC

Severity: normal

To reply to this bug, email your comments to 68948 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#68948; Package guix. (Tue, 06 Feb 2024 11:04:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to chris <chris <at> bumblehead.com>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Tue, 06 Feb 2024 11:04:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: chris <chris <at> bumblehead.com>
To: bug-guix <at> gnu.org
Cc: chris <at> bumblehead.com
Subject: highlight error, cannot open filetypes.conf: No such file or directory
Date: Tue, 6 Feb 2024 03:01:30 -0800
There is an issue using "highlight"

https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/pretty-print.scm#n353
http://www.andre-simon.de/doku/highlight/en/highlight.php#ch3_8

This unexpected error is reproduced easily with the command below: "cannot open filetypes.conf"
```
$ echo "(highlight (package bug))" | highlight -O xterm256 --syntax lisp
cannot open filetypes.conf: No such file or directory
(highlight (package bug))
```

Creating `~/.highlight/filetypes.conf` did not resolve the error.
Setting "HIGHLIGHT_DATADIR=$HOME/.config/highlight/" did not resolve the error.

Any advice is welcome. Thank you :)

Chris




Information forwarded to bug-guix <at> gnu.org:
bug#68948; Package guix. (Thu, 08 Feb 2024 02:05:01 GMT) Full text and rfc822 format available.

Message #8 received at 68948 <at> debbugs.gnu.org (full text, mbox):

From: chris <chris <at> bumblehead.com>
To: Sergey Trofimov <sarg <at> sarg.org.ru>
Cc: chris <chris <at> bumblehead.com>, 68948 <at> debbugs.gnu.org
Subject: Re: bug#68948: highlight error, cannot open filetypes.conf: No such
 file or directory
Date: Wed, 7 Feb 2024 18:02:26 -0800
Sergey,

I believe you intended a related message for the debbugs service, but only sent the message to my mail address. I am unsure and want to avoid showing impoliteness, I rephrased your message a bit below. Thank you,

Chris

-------------------

the highlight error goes away after copying the conf file this way
```
cp $(guix build highlight)/etc/highlight/filetypes.conf ~/.highlight/
```

strace shows that the conf is searched in wrong place:

--8<---------------cut here---------------start------------->8---
newfstatat(AT_FDCWD, "/home/user/.highlight/filetypes.conf", 0x7ffcd0778130,
0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/gnu/store/9mdd4ba8ri4j07acmbc2vhkiipbz9l63-highlight-4.8/share/highlight/filetypes.conf",
0x7ffcd0778130, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/gnu/store/9mdd4ba8ri4j07acmbc2vhkiipbz9l63-highlight-4.8/share/highlight/config/highlight/filetypes.conf",
0x7ffcd0778130, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "filetypes.conf", O_RDONLY) = -1 ENOENT (No such file or
directory)
futex(0x7f2c4827e1f0, FUTEX_WAKE_PRIVATE, 2147483647) = 0
write(2, "cannot open filetypes.conf: No s"..., 53cannot open
filetypes.conf: No such file or directory) = 53
--8<---------------cut here---------------end--------------->8---

but it is installed to
/gnu/store/...-highlight-.../etc/highlight/highlight.conf
the package recipe has to be fixed





Information forwarded to bug-guix <at> gnu.org:
bug#68948; Package guix. (Wed, 27 Mar 2024 21:00:04 GMT) Full text and rfc822 format available.

Message #11 received at 68948 <at> debbugs.gnu.org (full text, mbox):

From: chris <chris <at> bumblehead.com>
To: 68948 <at> debbugs.gnu.org
Cc: chris <at> bumblehead.com
Subject: temp fix
Date: Wed, 27 Mar 2024 13:58:03 -0700
The following workaround can be used,
```
HLDIRS=$(guix build highlight); # returns two directories
HLDIR="${HLDIRS##*[[:space:]]}"; # returns the second dir, after whitespace
DATADIR="$HLDIR/etc/highlight/";
echo "(highlight (package bug))" | highlight --data-dir=$DATADIR -O xterm256 --syntax lisp
```

Based on my understanding, the current package definition is correct. Possibly a patch like this could resolve the issue the current package definition seems correct.
```
diff --git a/gnu/packages/pretty-print.scm b/gnu/packages/pretty-print.scm
index b95f56729a..2a7cf74009 100644
--- a/gnu/packages/pretty-print.scm
+++ b/gnu/packages/pretty-print.scm
@@ -389,7 +389,7 @@ (define-public highlight
                           (lambda* (#:key inputs outputs #:allow-other-keys)
                             (let* ((out (assoc-ref outputs "out"))
                                    (data (string-append out
-                                                        "/share/highlight/"))
+                                                        "/etc/highlight/"))
                                    (conf (string-append out "/etc/highlight/"))
                                    (doc (string-append out
                                          "/share/doc/highlight/"))
```




Information forwarded to bug-guix <at> gnu.org:
bug#68948; Package guix. (Thu, 28 Mar 2024 11:54:02 GMT) Full text and rfc822 format available.

Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):

From: chris <chris <at> bumblehead.com>
To: bug-guix <at> gnu.org
Cc: chris <at> bumblehead.com
Subject: Re: highlight error, cannot open filetypes.conf: No such file or
 directory
Date: Thu, 28 Mar 2024 04:51:54 -0700
Below changes at the highlight package resolve the issue here but may adversely affect "highlight-gui" functionality. Will wait for https://issues.guix.gnu.org/70047 before trying to proceed,
```diff
-      #:make-flags #~(let ((confdir (string-append %output
-                                                   "/share/highlight/config/")))
-                       (list (string-append "PREFIX=" %output)
-                             (string-append "HL_CONFIG_DIR=" confdir)
-                             (string-append "conf_dir=" confdir)))
+      #:make-flags #~(list (string-append "PREFIX=" %output)
+                           (string-append "HL_CONFIG_DIR=" %output "/etc/")
+                           (string-append "conf_dir=" %output "/etc/"))
```




This bug report was last modified 36 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.