Skip to content

Commit

Permalink
Disable OPOST when running srun --pty to correct output format issue.
Browse files Browse the repository at this point in the history
This was re-enabled initially for debug messages with 03e156c,
but a better solution is to print "\r\n" when we log directly to
a terminal.

Bug 12226/11207
  • Loading branch information
mcmult authored and wickberg committed Aug 9, 2021
1 parent 8cde164 commit 77755b6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -35,6 +35,7 @@ documents those changes that are of interest to users and administrators.
-- Use FREE_NULL_LIST instead of list_destroy.
-- Fix bad pointer reference after bad unpack of jobacctinfo_t.
-- If we made are running an interactive session we need to force track_steps.
-- Disable OPOST flag when using --pty to avoid issues with Emac.

* Changes in Slurm 21.08.0rc1
=============================
Expand Down
6 changes: 3 additions & 3 deletions src/common/log.c
Expand Up @@ -1261,14 +1261,14 @@ static void _log_msg(log_level_t level, bool sched, bool spank, const char *fmt,

fflush(stdout);
if (spank) {
_log_printf(log, log->buf, stderr, "%s\n", buf);
_log_printf(log, log->buf, stderr, "%s\r\n", buf);
} else if (log->fmt == LOG_FMT_THREAD_ID) {
char tmp[64];
_set_idbuf(tmp, sizeof(tmp));
_log_printf(log, log->buf, stderr, "%s: %s%s\n",
_log_printf(log, log->buf, stderr, "%s: %s%s\r\n",
tmp, pfx, buf);
} else {
_log_printf(log, log->buf, stderr, "%s: %s%s\n",
_log_printf(log, log->buf, stderr, "%s: %s%s\r\n",
log->argv0, pfx, buf);
}
fflush(stderr);
Expand Down
3 changes: 0 additions & 3 deletions src/srun/srun.c
Expand Up @@ -661,9 +661,6 @@ static void _setup_one_job_env(slurm_opt_t *opt_local, srun_job_t *job,
tcgetattr(fd, &term);
/* Set raw mode on local tty */
cfmakeraw(&term);
/* Re-enable output processing such that debug() and
* and error() work properly. */
term.c_oflag |= OPOST;
tcsetattr(fd, TCSANOW, &term);
atexit(&_pty_restore);

Expand Down

0 comments on commit 77755b6

Please sign in to comment.