[Pkg-javascript-devel] Bug#1058552: Bug#1058552: science.js: FTBFS: SyntaxError: Error parsing /<<PKGBUILDDIR>>/package.json: Unexpected end of JSON input

James Valleroy jvalleroy at mailbox.org
Sat Apr 6 02:21:34 BST 2024


On Thu, 04 Apr 2024 19:01:58 +0200 Jonas Smedegaard <jonas at jones.dk> wrote:
> Quoting James Valleroy (2024-04-04 16:13:07)
> > On 3/28/24 4:08 AM, Petter Reinholdtsen wrote:
> > > [James Valleroy 2024-02-12]
> > >> Here is a patch that fixes the build:
> > > 
> > > Btw, did you mean TEMPFILE=$(shell mktemp) to get a random temp file
> > > name?
> > > 
> > 
> > I'm not sure. It may also work, but there is a difference in when a 
> > shell command runs. Some people recommend not to use shell in a 
> > makefile: https://stackoverflow.com/a/76121578
> 
> Each make target (i.e. each line indended by a tab) is executed within a
> shell.  The point in the SO answer you reference is that calling the
> make function $(shell ...) *inside* a make target effectively spawns a
> shell within another shell, and *that* you rarely really want.
> 
> What Petter is talking about above is that "TEMPFILE=mktemp", because it
> is a make target (i.e. on a TAB-indented line) is passed to a shell,
> which will *not* set TEMPFILE to the output of the shell command mktemp,
> but simply set TEMPFILE to the _string_ "mktemp" which is unlikely that
> you want.

I see, thanks for pointing that out. I think there isn't a need to use 
mktemp here, so the patch can be simplified to this:


diff --git a/Makefile b/Makefile
index c9e03c2..f5a954b 100644
--- a/Makefile
+++ b/Makefile
@@ -77,7 +77,8 @@ install:

  package.json: src/package.js
  	@rm -f $@
-	node src/package.js > $@
+	node src/package.js > package.json.temp
+	mv package.json.temp $@
  	@chmod a-w $@

  clean:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://alioth-lists.debian.net/pipermail/pkg-javascript-devel/attachments/20240405/cce656f0/attachment.sig>


More information about the Pkg-javascript-devel mailing list