- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.2k
 
Description
I have the following method running on Kotlin/Native linux/amd64:
    fun set(id: String, value: Long) {
        val bookmarkPath = path / id
        FileSystem.SYSTEM.sink(bookmarkPath).use { s ->
            s.buffer().use { b ->
                b.writeUtf8("$value\n")
            }
        }
    }Even though the content being sent to writeUtf8 is always the output of a Long.toString() followed by a line break, one of the files that is manipulated by this method ended up having its content being 7 zero bytes.
The output of xxd is as below:
[bruno@bruno-desktop ~]$ xxd data/bookmark/bookmark.txt
00000000: 0000 0000 0000 00                        .......
There is also the original file attached in case the output below needs to be verified: bookmark.txt
I think this is some sort of bug in okio for a few reasons:
- There is no other method that could have written to this file
 valueis of typeLong, so I can't see how thetoString()of a long could have produced 7 zero bytes, nor how could the\ncould have been ignored beforewriteUtf8is called.- There is always a single copy of the process that could have written to this file, and that's managed by 
systemd. The file system is a block device, so no network involved. 
This process is running for months, file always had a sequence of numerical chars followed by a \n. 2 days ago, though, for some still unknown reason, I found this file with the bogus content above.
Could anyone with good Okio knowledge help me investigate what could be causing that?