On 23 September 2014 15:51, <[email protected]> wrote:

> echo "Here is a string to translate" | apertium sl-tl >> myfile
>
> After that, myfile countains the translation but not the previous content.
> Exactly like if simple redirection > was used.
>
> What is the reason of this bug and could it be repared ?


The cause is twofold:

1) The special file /dev/stdout is a link to /proc/self/fd/1. So far, ok.
But, when using shell redirects, /proc/self/fd/1 becomes a link to the
actual file you're outputting to.

2) The apertium wrapper script uses > redirection internally. So far, ok.
But, when no output file is given, apertium defaults to /dev/stdout. Thus,
>/dev/stdout is used, which becomes >/the/actual/file and thus truncates
the file regardless of whether the shell used >>

Can it be repaired? Yes.

The fix is that when no output file is given, just print or pass through.
Don't try to write to the special file /dev/stdout, since that may truncate
when not wanted, or if you use append open mode then it may not truncate
when actually wanted.

-- Tino Didriksen
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Apertium-stuff mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/apertium-stuff

Reply via email to