Skip to content

Commit

Permalink
Merge pull request #2876 from 15596858998/dev
Browse files Browse the repository at this point in the history
Solve the bug of extra output newline character
  • Loading branch information
Cyan4973 authored Dec 1, 2021
2 parents 8031dc7 + e315a04 commit 3133d1e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 5 additions & 6 deletions programs/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -889,26 +889,25 @@ static int FIO_removeMultiFilesWarning(FIO_ctx_t* const fCtx, const FIO_prefs_t*
if (fCtx->nbFilesTotal > 1 && !prefs->overwrite) {
if (g_display_prefs.displayLevel <= displayLevelCutoff) {
if (prefs->removeSrcFile) {
DISPLAYLEVEL(1, "zstd: Aborting... not deleting files and processing into dst: %s", outFileName);
DISPLAYLEVEL(1, "zstd: Aborting... not deleting files and processing into dst: %s\n", outFileName);
error = 1;
}
} else {
if (!strcmp(outFileName, stdoutmark)) {
DISPLAYLEVEL(2, "zstd: WARNING: all input files will be processed and concatenated into stdout. ");
DISPLAYLEVEL(2, "zstd: WARNING: all input files will be processed and concatenated into stdout. \n");
} else {
DISPLAYLEVEL(2, "zstd: WARNING: all input files will be processed and concatenated into a single output file: %s ", outFileName);
DISPLAYLEVEL(2, "zstd: WARNING: all input files will be processed and concatenated into a single output file: %s \n", outFileName);
}
DISPLAYLEVEL(2, "\nThe concatenated output CANNOT regenerate the original directory tree. ")
DISPLAYLEVEL(2, "The concatenated output CANNOT regenerate the original directory tree. \n")
if (prefs->removeSrcFile) {
if (fCtx->hasStdoutOutput) {
DISPLAYLEVEL(1, "\nAborting. Use -f if you really want to delete the files and output to stdout");
DISPLAYLEVEL(1, "Aborting. Use -f if you really want to delete the files and output to stdout\n");
error = 1;
} else {
error = g_display_prefs.displayLevel > displayLevelCutoff && UTIL_requireUserConfirmation("This is a destructive operation. Proceed? (y/n): ", "Aborting...", "yY", fCtx->hasStdinInput);
}
}
}
DISPLAY("\n");
}
return error;
}
Expand Down
4 changes: 4 additions & 0 deletions tests/playTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,10 @@ test -f tmp2
test -f tmp3
test -f tmp4

println "test : survive the list of files with too long filenames (--filelist=FILE)"
datagen -g51M > tmp_badList
zstd -f --filelist=tmp_badList && die "should have failed : file name length is too long"

println "test : survive a list of files which is text garbage (--filelist=FILE)"
datagen > tmp_badList
zstd -f --filelist=tmp_badList && die "should have failed : list is text garbage"
Expand Down

0 comments on commit 3133d1e

Please sign in to comment.