does not use input output directory properly

Bug #327846 reported by themusicgod1
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
latex2rtf (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: latex2rtf

latex2rtf seems to allow, via -o commandline argument set, to specify the location of an output file. However the directory, at least for '.' is not listened to, even if given. The result is stored in the right filename, but in the home directory instead of the directory specified. This is at least the case when the input file is in the home directory, and the program is run from another directory.

example:

jcliff@CDD4:~/mirror/www.spiritsd.ca/test$ ls ~/*.tex
/home/jcliff/something.tex
jcliff@CDD4:~/mirror/www.spiritsd.ca/test$ latex2rtf -o ./out.rtf ~/something.tex
jcliff@CDD4:~/mirror/www.spiritsd.ca/test$ ls *.rtf
ls: cannot access *.rtf: No such file or directory
jcliff@CDD4:~/mirror/www.spiritsd.ca/test$ ls ~/*.rtf
/home/jcliff/out.rtf /home/jcliff/something.rtf

what should happen

jcliff@CDD4:~/mirror/www.spiritsd.ca/test$ ls ~/*.tex
/home/jcliff/something.tex
jcliff@CDD4:~/mirror/www.spiritsd.ca/test$ latex2rtf -o ./out.rtf ~/something.tex
jcliff@CDD4:~/mirror/www.spiritsd.ca/test$ ls *.rtf
out.rtf

Looking through the code it looks like it does something strange with slashes in teh filename itself.
(gdb) next
0x1e3d120 "/home/jcliff/./out.rtf

specifically, at main.c at lines 743-747 seems to be the issue:

<code>
        if (g_home_dir)
            name = strdup_together(g_home_dir, filename);
        else
            name = strdup(filename);
</code>

Where 'name' is the output file name, to be opened with fopen on the next line. The 'else' condition is what I would consider the desirable one, and seems to do what it needs to; opens the file at that location, not at some location that was not specified(file name under the home directory). I tested the 'else' condition and it does output to the correct directory.

So what I see is that there are two options here. One, the default, somewhat confusing behaviour can be kept, and there's probably a way to force the 'else' condition to occur.
On the other hand, there could be an option to force the odd behaviour, and have the default behaviour be that when -o is specified the next argument is what is, in fact, opened as the output file, bounded by whatever fopen can handle(which looks like quite a bit).

'dir' doesn't occur in /usr/share/latex2rtf/cfg, so it doesn't look like there's a configuration option to set either as default behaviour

edit: missed a crucial word.

edit: tests still necessary to do: make sure with the patch that the code works without an -o argument fine as well.

Revision history for this message
themusicgod1 (themusicgod1) wrote :
description: updated
description: updated
Revision history for this message
Brian Murray (brian-murray) wrote :

I've reformatted your patch so it is possible to apply it to the package. Thanks for your contribution.

Changed in latex2rtf:
status: New → Triaged
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package latex2rtf - 2.3.3-0.2

---------------
latex2rtf (2.3.3-0.2) unstable; urgency=low

  * Non-maintainer upload.
  * debian/control (Standards-Version): Bumped to 3.9.4.
  * debian/copyright: Updated.
  * debian/patches/ftbfs_fix_makeinfo.patch: Added.
    - Fix a newly occurred FTBFS running makeinfo.
  * debian/patches/series: Added.

 -- Daniel Leidert <email address hidden> Thu, 09 May 2013 14:19:46 +0200

Changed in latex2rtf (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.