From: talwrii talwrii <talwrii@gmail.com>
To: 24531@debbugs.gnu.org
Subject: bug#24531: process-send-string seems to truncate lines over 4096 characters
Date: Sat, 24 Sep 2016 18:38:18 -0500 [thread overview]
Message-ID: <CACVmLiT=-ASQh7C9SsBbaKLdP7sdCdqN735YACM-invrQTN-YA@mail.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1689 bytes --]
=== Repro ===
i. Download attached el file
ii. Read it to ensure I am not hacking your computer
iii. In the same directory run
emacs -Q --eval '(progn (load-file "line-repro.el") (message (format "%S"
(repro))))' -nw --batch
As the last line of output I get
(3005 4100 6006)
I wouild expect this 4100 to be 5005
The third value indicates it is the line that gets truncated rather than
the string
=== Version details ===
In GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of
2016-04-08 on binet, modified by Debian Windowing system distributor `The
X.Org Foundation', version 11.0.11804000 System Description: Debian
GNU/Linux testing (stretch) Configured using: `configure --build
x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
--libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info
--mandir=/usr/share/man --with-pop=yes
--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
--build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
--libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info
--mandir=/usr/share/man --with-pop=yes
--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
--with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g
-O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall'
'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro' Important
settings: value of $LANG: en_GB.UTF-8 locale-coding-system: utf-8-unix
[-- Attachment #1.2: Type: text/html, Size: 1994 bytes --]
[-- Attachment #2: line-repro.el --]
[-- Type: text/x-emacs-lisp, Size: 1741 bytes --]
(defun s-repeat (num s)
;; extracted from s.el
"Make a string of S repeated NUM times."
(let (ss)
(while (> num 0)
(setq ss (cons s ss))
(setq num (1- num)))
(apply 'concat ss)))
(defun s-concat (&rest strings)
;; extracted from s.el
"Join all the string arguments into one string."
(apply 'concat strings))
(setq tee-program "
import fcntl
import os
import select
import sys
fd = sys.stdin.fileno()
fl = fcntl.fcntl(fd, fcntl.F_GETFL)
fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)
filename, = sys.argv[1:]
with open(filename, 'w') as stream:
while True:
select.select([sys.stdin], [], [sys.stdin], 0.2)
data = sys.stdin.read()
if data == '':
break
else:
stream.write(data)
stream.flush()
")
(defun repro ()
(list
(length (write-to-file (s-repeat 3000 "a")))
(length (write-to-file (s-repeat 5000 "a")))
(length (write-to-file (s-concat (s-repeat 3000 "a") "\n" (s-repeat 3000 "a"))))
))
(defun write-to-file (input)
(let (p)
(if (not (file-exists-p "/tmp/bettertee.py"))
(write-region tee-program nil "/tmp/bettertee.py"))
(setq p (start-process "bocp" "*bocp*"
"python" "/tmp/bettertee.py" "/tmp/line-repro-bug"))
(process-send-string p input)
(process-send-string p "\nnext")
(process-send-eof p)
(message (format "Waiting for process to die"))
(while (process-live-p p)
(sit-for 0.1))
(message "Process is dead")
(get-string-from-file "/tmp/line-repro-bug")
))
(defun get-string-from-file (filePath)
"Return filePath's file content."
(with-temp-buffer
(insert-file-contents filePath) (buffer-string)))
next reply other threads:[~2016-09-24 23:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-24 23:38 talwrii talwrii [this message]
2016-09-26 8:36 ` bug#24531: process-send-string seems to truncate lines over 4096 characters Thien-Thi Nguyen
2016-09-26 10:23 ` Andreas Schwab
-- strict thread matches above, loose matches on Subject: below --
2010-05-10 4:14 bug#6149: 24.0.50; shell buffer overflow when input longer than 4096 bytes jidanni
2010-06-01 1:50 ` Stefan Monnier
2023-07-20 20:15 ` bug#6149: bug#24531: process-send-string seems to truncate lines over 4096 characters Spencer Baugh
2023-07-20 21:21 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-21 5:39 ` Eli Zaretskii
2023-07-21 13:58 ` Spencer Baugh
2023-07-21 14:18 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CACVmLiT=-ASQh7C9SsBbaKLdP7sdCdqN735YACM-invrQTN-YA@mail.gmail.com' \
--to=talwrii@gmail.com \
--cc=24531@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.