unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#30095: substitute* decoding-error
@ 2018-01-13  2:25 nee
  2018-01-13 12:49 ` Ricardo Wurmus
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: nee @ 2018-01-13  2:25 UTC (permalink / raw)
  To: 30095

[-- Attachment #1: Type: text/plain, Size: 746 bytes --]

Hello, attached is a package definition that fails because substitute*
throws an error. The file I try to substitute* on has some names with
special signs like ë and é that might be related?
I also included a sed workaround which can be uncommented and works
perfectly fine, so the itself file is not too broken to be edited and
this is a bug with substitute*.

The file in question is: src/main.cc from
https://sourceforge.net/projects/eureka-editor/files/Eureka/1.21/eureka-121-source.tar.gz/download

I tested this on the latest guix master. git log says:

commit 7c0926ea7c6f0d0fa291251017704dfb6fb21924 (origin/master,
origin/HEAD, eureka)
Author: Ludovic Courtès <ludo@gnu.org>
Date:   Sat Jan 13 00:57:52 2018 +0100



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-demonstrate-substitute-bug-in-eureka-package.patch --]
[-- Type: text/x-patch; name="0001-demonstrate-substitute-bug-in-eureka-package.patch", Size: 3892 bytes --]

From c92de18c559dac1be48f05ed39acbcd15120c0b6 Mon Sep 17 00:00:00 2001
From: nee <nee.git@cock.li>
Date: Sat, 13 Jan 2018 02:49:32 +0100
Subject: [PATCH] demonstrate substitute* bug in eureka package

---
 gnu/packages/game-development.scm | 70 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 69 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index 363d9a253..1937d0a59 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -45,6 +45,7 @@
   #:use-module (gnu packages curl)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages fltk)
   #:use-module (gnu packages fonts)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages freedesktop)
@@ -78,7 +79,9 @@
   #:use-module (gnu packages lua)
   #:use-module (gnu packages mp3)
   #:use-module (gnu packages xml)
-  #:use-module (gnu packages tls))
+  #:use-module (gnu packages tls)
+  ;; TODO remove
+  #:use-module (gnu packages base))
 
 (define-public bullet
   (package
@@ -1150,3 +1153,68 @@ features design tools such as a visual editor, can import 3D models and
 provide high-quality 3D rendering, it contains an animation editor, and can be
 scripted in a Python-like language.")
     (license license:expat)))
+
+(define-public eureka
+  (package
+    (name "eureka")
+    (version "1.21")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://sourceforge/eureka-editor/Eureka/"
+                                  version "/eureka-"
+                                  ;; version without dots e.g 1.21 => 121
+                                  (string-join (string-split version #\.) "")
+                                  "-source.tar.gz"))
+              (sha256
+               (base32
+                "1a7pf7xi56fcz7jc8layih5gq5m66g2ss4x5j61kzgip07j6rkir"))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:tests?
+       #f
+       #:make-flags
+       (let ((out (assoc-ref %outputs "out")))
+         (list (string-append "PREFIX=" out)))
+       #:phases
+       (modify-phases
+           %standard-phases
+         (delete 'configure)
+         (add-before
+             'build 'prepare-install-directories
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (mkdir-p (string-append out "/bin"))
+               (mkdir-p (string-append out "/share"))
+
+            ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+               ;; FIXME substitute* crashes because of an accent in the name of someone
+               ;; (system* (which "sed")
+               ;;          "-i" (string-append "s|/usr/local|" out "|")
+               ;;          "src/main.cc")
+               (substitute*
+                   "./src/main.cc"
+                 (("/usr/local")
+                  out))
+            ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+               (substitute*
+                   "Makefile"
+                 (("-o root")
+                  ""))))))))
+    (inputs `(("mesa" ,mesa)
+              ("libxft" ,libxft)
+              ("libxinerama" ,libxinerama)
+              ("libfontconfig" ,fontconfig)
+              ("libjpeg" ,libjpeg)
+              ("libpng" ,libpng)
+              ("fltk" ,fltk)
+              ("zlib" ,zlib)))
+    (native-inputs `(("pkg-config" ,pkg-config)
+                     ("xdg-utils" ,xdg-utils)
+                     ;; TODO remove when substitute* is fixed
+                     ("sed" ,sed)
+                     ("which" ,which)))
+    (synopsis "gzdoom")
+    (description "gzdoom")
+    (home-page "https://zdoom.org/")
+    (license license:gpl3+)))
-- 
2.15.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: substitute-error.log --]
[-- Type: text/x-log; name="substitute-error.log", Size: 1788 bytes --]

starting phase `prepare-install-directories'
Backtrace:
          11 (primitive-load "/gnu/store/fk2ms0qy9lxv1xjz3mr3a5zclcr…")
In ice-9/eval.scm:
   191:35 10 (_ _)
In srfi/srfi-1.scm:
   863:16  9 (every1 #<procedure a68140 at /gnu/store/xhwmxry8kkmq7…> …)
In /gnu/store/xhwmxry8kkmq7897558qmcmfsx8r1z45-module-import/guix/build/gnu-build-system.scm:
   684:27  8 (_ _)
In ice-9/eval.scm:
    619:8  7 (_ #(#(#(#<directory (guile-user) 7d10a0>) ((# . #))) #))
In ice-9/boot-9.scm:
    849:4  6 (with-throw-handler _ _ _)
In ice-9/ports.scm:
   444:17  5 (call-with-input-file _ _ #:binary _ #:encoding _ # _)
In /gnu/store/xhwmxry8kkmq7897558qmcmfsx8r1z45-module-import/guix/build/utils.scm:
   609:26  4 (_ _)
   645:22  3 (_ #<input: ./src/main.cc 15> #<input-output: ./src/mai…>)
In ice-9/rdelim.scm:
   195:24  2 (read-line _ _)
In unknown file:
           1 (%read-line #<input: ./src/main.cc 15>)
In ice-9/boot-9.scm:
   760:25  0 (dispatch-exception _ _ _)

ice-9/boot-9.scm:760:25: In procedure dispatch-exception:
ice-9/boot-9.scm:760:25: Throw to key `decoding-error' with args `("peek-char" "input decoding error" 84 #<input: ./src/main.cc 15>)'.
builder for `/gnu/store/0plpd4ly1vhj849ia5dqwqbrx1g1a6by-eureka-1.21.drv' failed with exit code 1
@ build-failed /gnu/store/0plpd4ly1vhj849ia5dqwqbrx1g1a6by-eureka-1.21.drv - 1 builder for `/gnu/store/0plpd4ly1vhj849ia5dqwqbrx1g1a6by-eureka-1.21.drv' failed with exit code 1
guix build: error: build failed: build of `/gnu/store/0plpd4ly1vhj849ia5dqwqbrx1g1a6by-eureka-1.21.drv' failed

Some deprecated features have been used.  Set the environment
variable GUILE_WARN_DEPRECATED to "detailed" and rerun the
program to get more information.  Set it to "no" to suppress
this message.


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#30095: substitute* decoding-error
  2018-01-13  2:25 bug#30095: substitute* decoding-error nee
@ 2018-01-13 12:49 ` Ricardo Wurmus
  2018-01-13 21:35 ` Ludovic Courtès
  2020-05-14 12:46 ` Ricardo Wurmus
  2 siblings, 0 replies; 4+ messages in thread
From: Ricardo Wurmus @ 2018-01-13 12:49 UTC (permalink / raw)
  To: nee; +Cc: 30095


Hi nee,

> Hello, attached is a package definition that fails because substitute*
> throws an error. The file I try to substitute* on has some names with
> special signs like ë and é that might be related?

You could try something like this:

   ;; This file is ISO-8859-1 encoded.
   (with-fluids ((%default-port-encoding #f))
     (substitute* "the/file"
       (("this") "that")))

-- 
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
https://elephly.net

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#30095: substitute* decoding-error
  2018-01-13  2:25 bug#30095: substitute* decoding-error nee
  2018-01-13 12:49 ` Ricardo Wurmus
@ 2018-01-13 21:35 ` Ludovic Courtès
  2020-05-14 12:46 ` Ricardo Wurmus
  2 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2018-01-13 21:35 UTC (permalink / raw)
  To: nee; +Cc: 30095

Hi,

nee <nee@cock.li> skribis:

> Hello, attached is a package definition that fails because substitute*
> throws an error. The file I try to substitute* on has some names with
> special signs like ë and é that might be related?

Most likely the file in question is not UTF-8-encoded, whereas
‘substitute*’ defaults to UTF-8.

If it’s Latin-1 (aka. ISO-8859-1), you can do:

  (with-fluids ((%default-port-encoding "ISO-8859-1"))
    (substitute* …))

which should solve the problem (there are a few examples of that in the
package definitions.)

HTH!

Ludo’.
  

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#30095: substitute* decoding-error
  2018-01-13  2:25 bug#30095: substitute* decoding-error nee
  2018-01-13 12:49 ` Ricardo Wurmus
  2018-01-13 21:35 ` Ludovic Courtès
@ 2020-05-14 12:46 ` Ricardo Wurmus
  2 siblings, 0 replies; 4+ messages in thread
From: Ricardo Wurmus @ 2020-05-14 12:46 UTC (permalink / raw)
  To: 30095-done

I’m closing this as eureka-editor has already been added to the Guix
package collection.

-- 
Ricardo




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-14 12:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-13  2:25 bug#30095: substitute* decoding-error nee
2018-01-13 12:49 ` Ricardo Wurmus
2018-01-13 21:35 ` Ludovic Courtès
2020-05-14 12:46 ` Ricardo Wurmus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).