Hi Siegfried,

First of all, thanks a million for helping me. :) I really don't have any clue of what's happening here. I hope I can delve into the deepest region of exec's code any time soon, so I can be more proactive and help you guys. :(

> 1) Can you remove the “.aux” extension when invoking “bibtex”?

Sure! :) I did some tests and bibtex complains as well:

------------------------
I couldn't open file name `"file with spaces".aux'
------------------------

> 2) Please check http://tex.stackexchange.com/questions/112606

Ah, that's very interesting indeed (specially coming from egreg, who is a good friend of mine). :) What really puzzles me is the fact that bibtex can accept .aux files with spaces (the only apparent restriction is the name of .bib files which are referenced inside .aux files), and a call to

------------------------
paulo@alexandria commons-exec-report$ bibtex "file with spaces.aux"
This is BibTeX, Version 0.99d (TeX Live 2013)
The top-level auxiliary file: file with spaces.aux
The style file: plain.bst
Database file #1: master.bib
Warning--I didn't find a database entry for "with:1977"
(There was 1 warning)
------------------------

in the command line just works. I'm starting to get nightmares. :(

Since now you've reached the TeX community at StackExchange and probably spotted me in there, I probably should give more info on my project as a whole. The software is named "arara" and it's a humble TeX automation tool. Here's the manual, just in case:

http://texdoc.net/texmf-dist/doc/support/arara/arara-usermanual.pdf

Exec plays an important role in the tool, so when one of the guys from my userbase complained about "arara not being able to deal with files with spaces", I got scared. As a result, I "wickedly blamed" exec. I owe you guys an apology. :(

I'll try to check if other execution approaches (say, a hardcoded ProcessBuilder) work, and report back.

All the best,

Paulo

Em 28-04-2014 15:34, Siegfried Goeschl escreveu:
Hi Paulo,

I’m also a bit puzzled :-)

1) Can you remove the “.aux” extension when invoking “bibtex”?
2) Please check 
http://tex.stackexchange.com/questions/112606/how-to-make-space-recognized-in-bib-filename-when-setting-bibliography

Cheers,

Siegfried Goeschl


On 24 Apr 2014, at 15:36, Paulo Roberto Massa Cereda <[email protected]> 
wrote:

Hello Siegfried,

sorry for the next dumb question (but I'm actually quite good at it)

Don't say such thing, you are helping me a lot with these questions. :)

There we go:

* what is the result of the failed "bibtex" invocation?

The message prompted is

-----------------
I couldn't open file name `"file with spaces.aux".aux'
-----------------

And the program returns 1 as exit value.

If I copy "file with spaces.aux" and rename it to "filewithnospaces.aux", I get

-----------------
This is BibTeX, Version 0.99d (TeX Live 2013)
The top-level auxiliary file: filewithnospaces.aux
The style file: plain.bst
Database file #1: master.bib
Warning--I didn't find a database entry for "with:1977"
(There was 1 warning)
-----------------

And the program returns 0 as exit value.

* is "bibtex" a native binary or a shell script?

Native binary.

paulo@alexandria ~$ file `which bibtex`
/opt/texbin/bibtex: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), 
dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped

* depending on the error - can you replace the "bibtex" with a shell
script to dump the current working directory - sometime the things
are not executing where you expect them (just battled Java-native
launchers where the current working directory can't be set

I replaced bibtex with a script that prints $PWD and the provided arguments. I 
got

Current directory ($PWD):
/home/paulo/Projetos/commons-exec-report

Arguments:
"file with spaces.aux"
Done.

with 0 as exit value.

Quite odd, isn't it? :) It's driving me crazy. Well, crazier. :P

All the best,

Paulo

Em 24-04-2014 10:14, Siegfried Goeschl escreveu:
Hi Pauolo,

sorry for the next dumb question (but I'm actually quite good at it)

* what is the result of the failed "bibtex" invocation?

* is "bibtex" a native binary or a shell script?

* depending on the error - can you replace the "bibtex" with a shell
script to dump the current working directory - sometime the things are
not executing where you expect them (just battled Java-native launchers
where the current working directory can't be set

Cheers,

Siegfried Goeschl

On 24.04.14 15:07, Paulo Roberto Massa Cereda wrote:
Hello Siegfried!

Wow, thanks for the fast response. :)

Deeply sorry, I forgot to mention the environment. I'm running my code
under Linux (Fedora 20, Java 1.7.0) and MacOSX (Mavericks, 10.9.2). I
was unaware of the .aux thing under Windows, it's good to know about it;
TeX tools use .aux files all the time, so it might be interesting to
investigate some side effects from it. :)

Apparently, the error persists with other tool named makeglossaries that
also uses this .aux file. I'm starting to get scared. :)

All the best,

Paulo

Em 24-04-2014 09:50, Siegfried Goeschl escreveu:
Hi Paulo,

some stupid thought and it might not even be related to your problem

"aux" is under Windows a reserved and can't be used as file name - see
http://en.wikipedia.org/wiki/Filename - are you running the stuff under
WIndows?

Is it possible to rename the offending file to something different then
".aux"

Cheers,

Siegfried Goeschl

On 24.04.14 14:36, Paulo Roberto Massa Cereda wrote:
Dear friends,

For some time, I was sure issue #54
(https://issues.apache.org/jira/browse/EXEC-54) was the culprit of one
my programs misbehaving. Today, I decided to devote some time in
understanding what's been happening in my code and apparently issue
#54 does not appear to be culprit here!

Here's a sample code that might explain what's happening. Note that I
use two programs here (pdflatex and bibtex, hopefully available from
any recent TeX distribution), and similar expansions lead to different
results. Apologies for the long code excerpt.

===============================================================
@Test
    public void testCommonsExecExecution() throws IOException,
InterruptedException {
        String program = "bibtex";
        String argument = "file with spaces.aux";
        CommandLine line = new CommandLine(program);
        line.addArgument(argument);

        // so far, everything ok
        assertEquals(line.toString(), "[bibtex, \"file with
spaces.aux\"]");

        DefaultExecuteResultHandler resultHandler = new
DefaultExecuteResultHandler();
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        PumpStreamHandler streamHandler = new PumpStreamHandler(out,
out);

        DefaultExecutor executor = new DefaultExecutor();
        executor.setStreamHandler(streamHandler);
        executor.execute(line, resultHandler);
        resultHandler.waitFor();

        // bibtex is executed with "file with spaces.aux".aux,
        // which is not what I expected
        assertEquals(out.toString(), "I couldn't open file name
`\"file with spaces.aux\".aux'\n");

        program = "pdflatex";
        argument = "file with spaces.tex";

        line = new CommandLine(program);
        line.addArgument(argument);

        // so far, everything ok
        assertEquals(line.toString(), "[pdflatex, \"file with
spaces.tex\"]");

        resultHandler = new DefaultExecuteResultHandler();
        out = new ByteArrayOutputStream();
        streamHandler = new PumpStreamHandler(out, out);

        executor = new DefaultExecutor();
        executor.setStreamHandler(streamHandler);
        executor.execute(line, resultHandler);
        resultHandler.waitFor();

        // here, pdflatex works with "file with spaces.tex"
        assertTrue(out.toString().contains("! I can't find file
`\"file with spaces.tex\"'."));

    }
===============================================================

Note that Exec has both

[ bibtex, file with spaces.aux ]
[ pdflatex, file with spaces.tex ]

parsed correctly, but only the latter execution is properly done. Now
I'm not sure if it's even Exec's fault, but what strikes me is the
fact that with pdflatex, the execution works.

Maybe I'm missing something obvious. Could you guys shed some light
into this problem?

All the best,

Paulo

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]





---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to