Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreeBSD >> operator does not append #334

Closed
benrubson opened this issue Jun 21, 2017 · 8 comments
Closed

FreeBSD >> operator does not append #334

benrubson opened this issue Jun 21, 2017 · 8 comments

Comments

@benrubson
Copy link
Contributor

Hello,

I just discovered this :

$ uname -sr
FreeBSD 11.0-RELEASE-p8
$ /tmp/encfs --version
encfs version 1.9.1
$
$ echo -e "line1\nline2\nline3" > test.txt
$ cat test.txt 
line1
line2
line3
$ echo line4 >> test.txt 
$ cat test.txt 
line4
line2
line3
$

EncFS does not correctly append content to the end of the file, as if it was not able to seek.

Ben

@Aikhjarto
Copy link
Contributor

Aikhjarto commented Jun 21, 2017

Cannot confirm on Leap 42.2 with kernel 4.11.6 and encfs 1.9.1.
On my system appending works.

@benrubson
Copy link
Contributor Author

Thank you for your test @Aikhjarto.
What is strange is that the internalModification test correctly works.
https://github.com/vgough/encfs/blob/v1.9.1/tests/normal.t.pl#L86
So sounds like seek() performs correctly.
Not sure exactly what >> internally does.

@benrubson
Copy link
Contributor Author

One more test :

# cat test.pl 
unlink "perltest.txt";
open(my $out, ">", "perltest.txt");
print($out "line1\nline2\nline3\n");
close($out);
open($out, ">>", "perltest.txt");
print($out "line4\n");
close($out);
# 
# perl test.pl 
# cat perltest.txt 
line1
line2
line3
line4
#

So appending using Perl seems to work...
Really strange !

@benrubson
Copy link
Contributor Author

OK, same issue using another Fuse FS, such as sshfs.

I've then opened a FreeBSD bug :
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=220185

@benrubson benrubson changed the title EncFS does not correctly append / seek FreeBSD >> operator does not append Jun 21, 2017
@rfjakob
Copy link
Collaborator

rfjakob commented Jun 21, 2017 via email

@benrubson
Copy link
Contributor Author

Good news, @cemeyer found the bug and proposed a FreeBSD patch 👍
I then close this issue.
Many thx !

@cemeyer
Copy link

cemeyer commented Jun 25, 2017

Perl must not use O_APPEND internally. Happy to help.

@benrubson
Copy link
Contributor Author

Good news, patch will be available in upcoming FreeBSD 11.1 :
https://svnweb.freebsd.org/changeset/base/320689

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants