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

\iow_close:N does nothing for \g_tmpa_iow #1105

Closed
Witiko opened this issue Jun 26, 2022 · 0 comments
Closed

\iow_close:N does nothing for \g_tmpa_iow #1105

Witiko opened this issue Jun 26, 2022 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@Witiko
Copy link
Contributor

Witiko commented Jun 26, 2022

\iow_close:N is defined as follows:

latex3/l3kernel/l3file.dtx

Lines 1553 to 1563 in d210490

\cs_new_protected:Npn \iow_close:N #1
{
\int_compare:nT { - \c_log_iow < #1 < \c_term_iow }
{
\tex_immediate:D \tex_closeout:D #1
\prop_gremove:NV \g_@@_streams_prop #1
\seq_if_in:NVF \g_@@_streams_seq #1
{ \seq_gpush:NV \g_@@_streams_seq #1 }
\cs_gset_eq:NN #1 \c_term_iow
}
}

However, \g_tmpa_iow does not seem to satisfy {- \c_log_iow < #1 < \c_term_iow }. Processing the following source with up-to-date pdfTeX produces a PDF document with the text false:

\input expl3-generic\relax
\ExplSyntaxOn
\iow_open:Nn
  \g_tmpa_iow
  { foo.bar }
\iow_now:Nn
  \g_tmpa_iow
  { baz }
\int_compare:nTF
  { - \c_log_iow < \g_tmpa_iow < \c_term_iow }
  { true  }
  { false }
\iow_close:N
  \g_tmpa_iow
\ExplSyntaxOff
\bye

This seems to suggest that the final \iow_close:N \g_tmpa_iow will do nothing, which does not seem right.

This has practical repercussions. Without a \closeout, I have no guarantee that my write has been flushed. Indeed, if I place ~\input_file:n { foo.bar } below \iow_close:N \g_tmpa_iow, processing the source with pdfTeX will still only produce the text false. It is only after replacing \iow_close:N with \immediate \closeout that processing the source with pdfTeX produces the text false baz as would be expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants