aboutsummaryrefslogtreecommitdiff
path: root/internal/tlog
AgeCommit message (Collapse)Author
2021-12-11tlog: only enable color if both stderr and stdout are a terminalJakob Unterwurzacher
This gocryptfs -init /does/not/exist 2> err.log used to write escape codes into err.log. Stop doing that.
2021-12-11tlog: respect NO_COLORJakob Unterwurzacher
Fixes https://github.com/rfjakob/gocryptfs/issues/617
2021-08-19tlog: switch from golang.org/x/crypto/ssh/terminal to golang.org/x/termJakob Unterwurzacher
$ golangci-lint run internal/tlog/log.go:13:2: SA1019: package golang.org/x/crypto/ssh/terminal is deprecated: this package moved to golang.org/x/term. (staticcheck) "golang.org/x/crypto/ssh/terminal"
2021-05-18fsck: redirect go-fuse noise to syslogJakob Unterwurzacher
2018-10-17tlog: disable color codes when switching to syslogJakob Unterwurzacher
When gocryptfs was started on a terminal and later daemonized, the color codes stayed active in the syslog output. The codes are not visible in "journalctl -f", which is why I have not noticed it yet, but they do show up in normal syslog as the usual "#033[33m" crap.
2018-09-23tlog: always trim trailing newlinesJakob Unterwurzacher
The messages we print through tlog sometimes do, sometimes do not contain a trailing newline. The stdlib logger usually drops trailing newlines automatically, but tlog postfixes ColorReset to the caller's message, so the logger logic does not work when we print colored output. Drop the newlines on our own, and add a test. Fixes the blank lines in fsck output: ~/go/src/github.com/rfjakob/gocryptfs/tests/fsck$ ./run_fsck.bash Reading password from extpass program Decrypting master key OpenDir "": invalid entry "invalid_file_name.3": illegal base64 data at input byte 17 OpenDir "": invalid entry "invalid_file_name_2": bad message fsck: corrupt entry in dir "": "invalid_file_name.3" fsck: corrupt entry in dir "": "invalid_file_name_2" OpenDir "": invalid entry "invalid_file_name____1": bad message fsck: corrupt entry in dir "": "invalid_file_name____1" doRead 4327225: corrupt block #0: stupidgcm: message authentication failed fsck: error reading file "corrupt_file" (inum 4327225): 5=input/output error cipherSize 40 < overhead 50: corrupt file doRead 4327074: corrupt header: ParseHeader: invalid version, want=2 have=22616 cipherSize 40 < overhead 50: corrupt file fsck: error reading file "corrupt_file_2" (inum 4327074): 5=input/output error Readlink "s-P7PcQDUcVkoeMDnC3EYA": decrypting target failed: stupidgcm: message authentication failed fsck: error reading symlink "corrupt_symlink": 5=input/output error Readlink "iI0MtUdzELPeOAZYwYZFee169hpGgd3l2PXQBcc9sl4": decrypting target failed: illegal base64 data at input byte 0 fsck: error reading symlink "corrupt_symlink_2": 5=input/output error OpenDir "yrwcjj2qoC4IYvhw9sbfRg": could not read gocryptfs.diriv: wanted 16 bytes, got 17 fsck: error opening dir "diriv_too_long": 5=input/output error OpenDir "trqecbMNXdzLqzpk7fSfKw": could not read gocryptfs.diriv: wanted 16 bytes, got 3 fsck: error opening dir "diriv_too_short": 5=input/output error cipherSize 8 < header size 18: corrupt file readFileID 4327049: incomplete file, got 8 instead of 19 bytes fsck: corrupt file "incomplete_file_1" (inode 4327049) readFileID 4327038: incomplete file, got 18 instead of 19 bytes fsck: corrupt file "incomplete_file_2" (inode 4327038) cipherSize 1 < header size 18: corrupt file readFileID 4327063: incomplete file, got 1 instead of 19 bytes fsck: corrupt file "incomplete_file_3" (inode 4327063) fsck: error opening dir "missing_diriv": 2=no such file or directory ListXAttr: invalid xattr name "user.gocryptfs.0a5e7yWl0SGUGeWB0Sy2K0": bad message fsck: corrupt xattr name on file "xattr_corrupt_name": "user.gocryptfs.0a5e7yWl0SGUGeWB0Sy2K0" GetXAttr: stupidgcm: message authentication failed fsck: error reading xattr "user.foo" from "xattr_corrupt_value": 5=input/output error fsck summary: 15 corrupt files
2018-07-01Only print masterkey once on -initJakob Unterwurzacher
It is no longer printed at all when mounting a filesystem, printing on -init can be disabled with -q. https://github.com/rfjakob/gocryptfs/issues/76
2018-04-02fsck: clean up log outputJakob Unterwurzacher
Make sure we get only 1 warning output per problem. Also, add new corruption types to broken_fs_v1.4.
2018-02-28tlog: stop embedding log.Logger to prevent mistakesJakob Unterwurzacher
A few places have called tlog.Warn.Print, which directly calls into log.Logger due to embedding, losing all features of tlog. Stop embedding log.Logger to make sure the internal functions cannot be called accidentially and fix (several!) instances that did.
2017-03-05Drop Go 1.4 compatability code everywhereJakob Unterwurzacher
Yields a nice reduction in code size.
2017-01-26tlog: better comment for the terminal colorsJakob Unterwurzacher
2016-10-04A few more lint fixesJakob Unterwurzacher
2016-10-04lint fixesValient Gough
2016-07-06Add godoc comments to all internal packagesJakob Unterwurzacher
2016-06-27tlog: clean up messages from the go-fuse libraryJakob Unterwurzacher
Drop the date and add the "go-fuse: " prefix so you can see where the message is coming from. Before: Jun 27 09:03:15 brikett gocryptfs[4150]: 2016/06/27 09:03:15 Unimplemented opcode INTERRUPT After: Jun 27 09:10:58 brikett gocryptfs[4961]: go-fuse: Unimplemented opcode INTERRUPT
2016-06-26tlog: switch default logger to syslogJakob Unterwurzacher
...unless "-nosyslog" is passed. All gocryptfs messages already go to syslog, but the messages that the go-fuse lib emits were still printed to stdout. Fixes issue #13 ( https://github.com/rfjakob/gocryptfs/issues/13 )
2016-06-15Rename internal "toggledlog" package to "tlog"Jakob Unterwurzacher
tlog is used heavily everywhere and deserves a shorter name. Renamed using sed magic, without any manual rework: find * -type f -exec sed -i 's/toggledlog/tlog/g' {} +