does not use input output directory properly
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@
/home/jcliff/
jcliff@
jcliff@
ls: cannot access *.rtf: No such file or directory
jcliff@
/home/jcliff/
what should happen
jcliff@
/home/jcliff/
jcliff@
jcliff@
out.rtf
Looking through the code it looks like it does something strange with slashes in teh filename itself.
(gdb) next
0x1e3d120 "/home/
specifically, at main.c at lines 743-747 seems to be the issue:
<code>
if (g_home_dir)
name = strdup_
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/
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.
description: | updated |
I've reformatted your patch so it is possible to apply it to the package. Thanks for your contribution.