public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* Compilation (make) problem
@ 2013-09-20 18:51 Matthieu Vachon
  2013-09-20 19:53 ` Per Bothner
  0 siblings, 1 reply; 3+ messages in thread
From: Matthieu Vachon @ 2013-09-20 18:51 UTC (permalink / raw)
  To: kawa

Hi,

Under CentOS 6.3, I have some problems executing the Makefile found in
the `bin/` directory.

When arriving at this Makefile, the build failed saying that `tmp` is
a folder and cannot be written to. This problem comes from this line
in the Makefile (there is more that one instance):

    echo '#!/bin/sh' >tmp

This kind of lines are seen in target `kawa.sh`, `gckawa` and `gexo`.
I understand the purpose of this code, i.e. creating a temp file
containing the generated script then putting it at the right place.
But I can't find if it is either injected, or it's a macro, or what
else.

For now, my workaround is to replace all instance of `> tmp` by `>
/tmp/tempfile.out` so it can output the data correctly.

What would be the right fix for this problem?

Regards.
Matt

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

* Re: Compilation (make) problem
  2013-09-20 18:51 Compilation (make) problem Matthieu Vachon
@ 2013-09-20 19:53 ` Per Bothner
  2013-09-21  6:05   ` Matthieu Vachon
  0 siblings, 1 reply; 3+ messages in thread
From: Per Bothner @ 2013-09-20 19:53 UTC (permalink / raw)
  To: Matthieu Vachon; +Cc: kawa

On 09/20/2013 11:51 AM, Matthieu Vachon wrote:
> When arriving at this Makefile, the build failed saying that `tmp` is
> a folder and cannot be written to. This problem comes from this line
> in the Makefile (there is more that one instance):
>
>      echo '#!/bin/sh' >tmp
> ...
> What would be the right fix for this problem?

The testsuite mostly uses names that *start* with tmp,
such as tmp.out or tmp-knucleotide1.log.

Using the tmp.xxx form is compatible with the mktemp
command, but it is conceivable some filesystems (like FAT)
would have problems (but they would probably have problems
regardless), so perhaps the tmp-xxx form is preferable.

So for gckawa instead of tmp maybe use tmp-gckawa.

The CLEANFILES macro would need to be updated,
presumably to tmp-*.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

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

* Re: Compilation (make) problem
  2013-09-20 19:53 ` Per Bothner
@ 2013-09-21  6:05   ` Matthieu Vachon
  0 siblings, 0 replies; 3+ messages in thread
From: Matthieu Vachon @ 2013-09-21  6:05 UTC (permalink / raw)
  To: kawa

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

Ok, I understand what was my problem. In the `bin/` folder I had a
directory named `tmp`. This was collapsing with target that was trying
to create a tmp file with name `tmp`. Since I had the directory, make
was not happy. I don't know where the `tmp` folder was coming from
tough.

I attached a patch that now use a more specific tmp file instead of
`tmp`. Feel free to include it or not since there is no real bug in
the Makefile.

Regards,
Matt

On Fri, Sep 20, 2013 at 3:53 PM, Per Bothner <per@bothner.com> wrote:
> On 09/20/2013 11:51 AM, Matthieu Vachon wrote:
>>
>> When arriving at this Makefile, the build failed saying that `tmp` is
>> a folder and cannot be written to. This problem comes from this line
>> in the Makefile (there is more that one instance):
>>
>>      echo '#!/bin/sh' >tmp
>> ...
>>
>> What would be the right fix for this problem?
>
>
> The testsuite mostly uses names that *start* with tmp,
> such as tmp.out or tmp-knucleotide1.log.
>
> Using the tmp.xxx form is compatible with the mktemp
> command, but it is conceivable some filesystems (like FAT)
> would have problems (but they would probably have problems
> regardless), so perhaps the tmp-xxx form is preferable.
>
> So for gckawa instead of tmp maybe use tmp-gckawa.
>
> The CLEANFILES macro would need to be updated,
> presumably to tmp-*.
> --
>         --Per Bothner
> per@bothner.com   http://per.bothner.com/

[-- Attachment #2: feature-minimize-tmpfile-collision.patch --]
[-- Type: application/octet-stream, Size: 6140 bytes --]

Index: Makefile.am
===================================================================
--- Makefile.am	(revision 7600)
+++ Makefile.am	 (working copy)
@@ -117,7 +117,7 @@ EXTRA_DIST = debian/control debian/rules debian/changelog debian/dirs \
   gnu/jemacs/jar-manifest gnu/jemacs/status.html \
   kawa/Version.java jar-manifest Make-rules classes-to-skip-for-runtime
 
-MOSTLYCLEANFILES = tmp *.o kawa1$(exeext) *.stamp classes.list classes-rt.list
+MOSTLYCLEANFILES = tmp* *.o kawa1$(exeext) *.stamp classes.list classes-rt.list
 CLEANFILES = *.jar kawa/Version.java $(META_ScriptEngineFactory)
 DISTCLEANFILES = selected-java-source
 
Index: bin/Makefile.am
===================================================================
--- bin/Makefile.am	(revision 7600)
+++ bin/Makefile.am	 (working copy)
@@ -83,42 +83,42 @@ EXTRA_LIB_SERVLET = -l-javax-servlet
 endif
 
 kawa.sh:
-	echo '#!/bin/sh' >tmp
-	echo 'thisfile=`which $$0`' >>tmp
-	echo 'thisdir=`dirname $$thisfile`' >>tmp
+	echo '#!/bin/sh' >tmp-kawa.sh.out
+	echo 'thisfile=`which $$0`' >>tmp-kawa.sh.out
+	echo 'thisdir=`dirname $$thisfile`' >>tmp-kawa.sh.out
 if ENABLE_KAWA_FRONTEND
 # In this case kawa.sh is only used for pre-install testing.
 # We don't need to set KAWALIB, since kawapath.c looks for it in "..".
-	echo 'LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$$thisdir' >>tmp
-	echo 'export LD_LIBRARY_PATH' >>tmp
-	echo 'exec $$thisdir/kawa "$$@"' >>tmp
+	echo 'LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$$thisdir' >>tmp-kawa.sh.out
+	echo 'export LD_LIBRARY_PATH' >>tmp-kawa.sh.out
+	echo 'exec $$thisdir/kawa "$$@"' >>tmp-kawa.sh.out
 else
 if WITH_GCJ_NO_DBTOOL
-	echo 'LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$$thisdir:$(libdir)' >>tmp
-	echo 'export LD_LIBRARY_PATH' >>tmp
-	echo 'exec $$thisdir/kawa-bin "$$@"' >>tmp
+	echo 'LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$$thisdir:$(libdir)' >>tmp-kawa.sh.out
+	echo 'export LD_LIBRARY_PATH' >>tmp-kawa.sh.out
+	echo 'exec $$thisdir/kawa-bin "$$@"' >>tmp-kawa.sh.out
 else
-	echo 'if test -f $$thisdir/../$(KAWAJAR)' >>tmp
-	echo 'then KAWALIB=$${KAWALIB-"`$(CYGPATH_W) "$$thisdir/../$(KAWAJAR)"`"}' >>tmp
-	echo 'else KAWALIB=$${KAWALIB-$(KAWALIB)}; fi' >>tmp
-	echo 'CLASSPATH="$${KAWALIB}$(CLASSPATH_SEPARATOR)$(conf_classpath)$${CLASSPATH-$(CLASSPATH)}"' >>tmp
-	echo 'export CLASSPATH' >>tmp
+	echo 'if test -f $$thisdir/../$(KAWAJAR)' >>tmp-kawa.sh.out
+	echo 'then KAWALIB=$${KAWALIB-"`$(CYGPATH_W) "$$thisdir/../$(KAWAJAR)"`"}' >>tmp-kawa.sh.out
+	echo 'else KAWALIB=$${KAWALIB-$(KAWALIB)}; fi' >>tmp-kawa.sh.out
+	echo 'CLASSPATH="$${KAWALIB}$(CLASSPATH_SEPARATOR)$(conf_classpath)$${CLASSPATH-$(CLASSPATH)}"' >>tmp-kawa.sh.out
+	echo 'export CLASSPATH' >>tmp-kawa.sh.out
 	if JAVA=`which $(JAVA)`; then true; else JAVA=$(JAVA); fi; \
-	  echo 'exec $${JAVA-"'$${JAVA}'"} kawa.repl "$$@"' >>tmp
+	  echo 'exec $${JAVA-"'$${JAVA}'"} kawa.repl "$$@"' >>tmp-kawa.sh.out
 endif
 endif
-	chmod +x tmp
-	mv tmp kawa.sh
+	chmod +x tmp-kawa.sh.out
+	mv tmp-kawa.sh.out kawa.sh
 
 gckawa: Makefile
-	echo '#!/bin/sh' >tmp
-	echo 'LD_LIBRARY_PATH=$(libdir):$$LD_LIBRARY_PATH' >>tmp
-	echo 'KAWALIB=$${KAWALIB-$(KAWALIB)}' >>tmp
-	echo 'CLASSPATH=$${KAWALIB}:$${CLASSPATH-$(CLASSPATH)}' >>tmp
-	echo 'export CLASSPATH LD_LIBRARY_PATH' >>tmp
-	echo 'exec gcj $(EXTRA_GCJFLAGS) "$$@" -L$(libdir) $(LDFLAGS_DBTOOL) -lkawa' >>tmp
-	chmod +x tmp
-	mv tmp gckawa
+	echo '#!/bin/sh' >tmp-gckawa.out
+	echo 'LD_LIBRARY_PATH=$(libdir):$$LD_LIBRARY_PATH' >>tmp-gckawa.out
+	echo 'KAWALIB=$${KAWALIB-$(KAWALIB)}' >>tmp-gckawa.out
+	echo 'CLASSPATH=$${KAWALIB}:$${CLASSPATH-$(CLASSPATH)}' >>tmp-gckawa.out
+	echo 'export CLASSPATH LD_LIBRARY_PATH' >>tmp-gckawa.out
+	echo 'exec gcj $(EXTRA_GCJFLAGS) "$$@" -L$(libdir) $(LDFLAGS_DBTOOL) -lkawa' >>tmp-gckawa.out
+	chmod +x tmp-gckawa.out
+	mv tmp-gckawa.out gckawa
 
 kawa.bat: $(srcdir)/kawa.bat.in
 	sed -e 's|%DEFAULT_KAWA_VERSION%|$(VERSION)|' \
@@ -126,23 +126,23 @@ kawa.bat: $(srcdir)/kawa.bat.in
 	  <$(srcdir)/kawa.bat.in > kawa.bat
 
 qexo:
-	echo '#!/bin/sh' >tmp
-	echo 'case $$0 in' >>tmp
-	echo '  */qexo)' >>tmp
-	echo '    kawa=`echo $$0 | sed -e '"'"'s|qexo$$|kawa|'"'"'`' >>tmp
-	echo '    if test -x $$kawa.sh; then' >>tmp
-	echo '      kawa=$$kawa.sh' >>tmp
-	echo '    elif test -x $$kawa; then true' >>tmp
-	echo '    else' >>tmp
-	echo '      kawa="kawa"' >>tmp
-	echo '    fi' >>tmp
-	echo '  ;;' >>tmp
-	echo '  *)' >>tmp
-	echo '    kawa="kawa";' >>tmp
-	echo 'esac' >>tmp
-	echo 'exec $$kawa --xquery "$$@"' >>tmp
-	chmod +x tmp
-	mv tmp qexo
+	echo '#!/bin/sh' >tmp-qexo.out
+	echo 'case $$0 in' >>tmp-qexo.out
+	echo '  */qexo)' >>tmp-qexo.out
+	echo '    kawa=`echo $$0 | sed -e '"'"'s|qexo$$|kawa|'"'"'`' >>tmp-qexo.out
+	echo '    if test -x $$kawa.sh; then' >>tmp-qexo.out
+	echo '      kawa=$$kawa.sh' >>tmp-qexo.out
+	echo '    elif test -x $$kawa; then true' >>tmp-qexo.out
+	echo '    else' >>tmp-qexo.out
+	echo '      kawa="kawa"' >>tmp-qexo.out
+	echo '    fi' >>tmp-qexo.out
+	echo '  ;;' >>tmp-qexo.out
+	echo '  *)' >>tmp-qexo.out
+	echo '    kawa="kawa";' >>tmp-qexo.out
+	echo 'esac' >>tmp-qexo.out
+	echo 'exec $$kawa --xquery "$$@"' >>tmp-qexo.out
+	chmod +x tmp-qexo.out
+	mv tmp-qexo.out qexo
 
 gnu-commonlisp-lang$(OEXT):
 	cd ../gnu/commonlisp/lang && $(MAKE)
Index: doc/Makefile.am
===================================================================
--- doc/Makefile.am	(revision 7600)
+++ doc/Makefile.am	 (working copy)
@@ -23,18 +23,18 @@ TEXI2PDF = texi2pdf
 
 man_MANS = kawa.1 qexo.1
 kawa.1: $(srcdir)/kawa.man
-	nroff -man $(srcdir)/kawa.man > kawa1.tmp
-	mv kawa1.tmp kawa.1
+	nroff -man $(srcdir)/kawa.man > tpm-kawa.1.out
+	mv tpm-kawa.1.out kawa.1
 
 qexo.1: $(srcdir)/qexo.man
-	nroff -man $(srcdir)/qexo.man > qexo1.tmp
-	mv qexo1.tmp qexo.1
+	nroff -man $(srcdir)/qexo.man > tpm-qexo1.out
+	mv tpm-qexo1.out qexo.1
 
 ../kawa-doc-$(VERSION).tar.gz: kawa/index.html kawa.pdf
 	tar cf - kawa/*.html kawa.pdf|gzip -c --best >$@
 
 clean-local:
-	-rm -rf $(KAWA_HTMLDIR) kawa1.tmp kawa.1 qexo.1
+	-rm -rf $(KAWA_HTMLDIR) tpm-qexo1.out tpm-qexo1.out kawa.1 qexo.1
 
 EXTRA_DIST = scm2java.html kawa.man qexo.man mdate-sh
 info_TEXINFOS = kawa.texi

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

end of thread, other threads:[~2013-09-21  6:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-20 18:51 Compilation (make) problem Matthieu Vachon
2013-09-20 19:53 ` Per Bothner
2013-09-21  6:05   ` Matthieu Vachon

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).