Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

! Emergency stop. 時のファイル名の表示 #100

Closed
h-kitagawa opened this issue Apr 25, 2020 · 2 comments
Closed

! Emergency stop. 時のファイル名の表示 #100

h-kitagawa opened this issue Apr 25, 2020 · 2 comments

Comments

@h-kitagawa
Copy link
Member

#45 とどれほど関係があるかわかりませんが,Slack にもほぼ同じことを書いたのでここに書いておきます.

hoge.tex を

\message{ゆ き だ る ま}\endinput

という一行だけのファイルとし,これを ptex で処理すると

$ ptex hoge
This is pTeX, Version 3.14159265-p3.8.3 (utf8.euc) (TeX Live 2020) (preloaded format=ptex)
 restricted \write18 enabled.
(./hoge.tex ゆ き だ る ま)
*

と入力待ち状態になります.その後 Ctrl-D を押すと ! Emergency stop. になるわけですが,その際に出力されるメッセージが

<*> ^^@oge

と,先頭バイトだけ NUL に変わってしまいます.

tex, pdftex ですと

<*> hoge

ときちんとファイル名全体が表示されます

@h-kitagawa
Copy link
Member Author

ptexenc.c の input_line2 関数で,buffer[last] = '\0';……① と NUL を書き込んでいることが直接の原因のようです.

pTeX が input_line 関数(lib/openclose.c) でファイル終端以外の「一行」を読むときには,input_line2 で一行読んた後に buffer[last] = ' '; と上書きされます.そのため①がどこまで必要なのかわかりませんが,とりあえず①を

if (i != EOF || first != last) buffer[last] = '\0';

とすると症状は収まるようです.

@t-tk
Copy link
Collaborator

t-tk commented May 10, 2020

有難うございます。
動作を確認しました。
TeX Live svnにコミットしました。(r55082)

@t-tk t-tk closed this as completed May 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants