[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#280356: apt-cdrom handles long lines in sources.list poorly



Package: apt
Version: 0.5.27

When apt-cdrom rewrites sources.list to add a CD reference, it uses a
300-byte buffer to read lines from the old sources.list.  For some
reason, if a line in sources.list is longer than 300 characters, the
ifstream object used for reading gets confused.  Subsequent reads result
in zero bytes being read.  Since we haven't reached EOF (there's still
the rest of that line, at least, to read), and since we have lost the
ability to read more data from the ifstream, the loop is infinite.

Moreover, newlines are stripped from the input sources.list, meaning
that they have to be replaced on output.  Since we're reading zero bytes
every time, we're writing a zero-byte string on every loop iteration
followed by a newline.  This will continue until the disk on which
sources.list exists is full.

I'm not sure if the bug is in apt or in libstdc++, since it is an
ifstream that's acting badly, but since the behavior is easily
duplicated in apt, that's where I'm filing.

[Sorry, Matt, for getting to this late; things have been busy at Progeny
the past week...]




Reply to: