Commit ID 257d20967c123ab76a019872b0bfd4d753155f4b
|Contributor:||Jim Meyering||Files Modified:||2|
|Date:||11-July-2011 at 15:22||Lines Added:||2|
|Repository:||git://git.sv.gnu.org/sed.git ssed||Lines Removed:||2|
|Commit Comment:||avoid silent data loss when an input line is 231 bytes or longer
If one line in a file has length (including newline) of 231, then
applying sed -i to that file truncates it to size 0. I first
noticed it like this: Create a file with line of length 231-1
$ perl -le 'print "v"x(2**31-1)' > k
Then prepend a byte to that line:
$ sed -i 's/^/v/' k
Surprise! The file is empty.
* sed/utils.c (ck_getline): Declare "result" to be of type ssize_t,
rather than int, to match the return type of getline.
|Language||Code Added||Code Removed||Comments Added||Comment Removed||Blanks Added||Blanks Removed|
|File||Language||Code Added||Code Removed||Comments Added||Comment Removed||Blanks Added||Blanks Removed|
|ChangeLog||No source code was detected in this file.|
Copyright © 2013 Black Duck Software, Inc. and its contributors, Some Rights Reserved. Unless otherwise marked, this work is licensed under a Creative Commons Attribution 3.0 Unported License . Ohloh ® and the Ohloh logo are trademarks of Black Duck Software, Inc. in the United States and/or other jurisdictions. All other trademarks are the property of their respective holders.