Opened 6 years ago

Closed 6 years ago

#1000 closed defect (fixed)

subscriptions.txt edited in webinterface won't save last line unless a newline is appended

Reported by: wasntme Owned by:
Priority: blocker Milestone: 0.9.8
Component: api/utils Version: 0.9.7.1
Keywords: subscriptions addressbook newline Cc: Zlatin Balevsky
Parent Tickets: Sensitive: no

Description

I2P version: 0.9.7.1-0-deb1p1
Java version: Oracle Corporation 1.7.0_21 (OpenJDK Runtime Environment 1.7.0_21-b02)
Wrapper version: 3.5.19
Server version: 7.6.11.v20130520
Servlet version: Jasper JSP 2.1 Engine
Platform: Linux amd64 3.2.0-4-amd64
Processor: Athlon 64 (unknown) (athlon64)
Jbigi: Locally optimized native BigInteger? library loaded from file
Encoding: UTF-8
Charset: UTF-8

Hi there,
I noticed some odd behavior, one of my subscriptions was always disappearing a while after adding. With some help I found out that it was missing a newline at the end and thus not written to the disk.

It appears to be correct in http://127.0.0.1:7657/susidns/subscriptions but counter checking on the disk will show that the last entry (not terminated by a newline) is missing.
Trying to save again, this time with newline appended, it appears on the disk immediately.

Subtickets

Change History (4)

comment:1 Changed 6 years ago by DISABLED

Duplicated. Also on debian build.

comment:2 Changed 6 years ago by zzz

Cc: Zlatin Balevsky added
Component: apps/addressbookapi/utils
Priority: minorblocker

Nice. Happy 1000.

Appears that the bug is in DataHelper?.readLine() line 1307, should be

return i > 0
c != 1;

Unless for some reason we want it to throw out an unterminated line.

To be analyzed / reviewed / tested to make sure this isn't the intended behavior and doesn't break anything else. And identify what else this may fix.

Still minor but bumping to blocker so we get this into the next release.

comment:3 Changed 6 years ago by zzz

there was an \|\| in the return line above but the markdown ate it

comment:4 Changed 6 years ago by zzz

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.