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

Redirecting command output to file results in different row counts each time #5643

Closed
bobf32 opened this issue Jul 23, 2020 · 4 comments
Closed
Labels

Comments

@bobf32
Copy link

bobf32 commented Jul 23, 2020

Environment

Windows build number: Win32NT             10.0.19041.0 Microsoft Windows NT 10.0.19041.0
Your Distribution version: (Debian) Release:        10
Whether the issue is on WSL 2 and/or WSL 1:Linux version 4.19.104-microsoft-standard (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Wed Feb 19 06:37:35 UTC 2020

Steps to reproduce

Run the following command multiple times:

/mnt/c/Program\ Files\ (x86)/Calibre2/calibredb.exe --with-library http://localhost:8080/#Calibre_Library list -s "vl:Unread" -f "id" --sort-by id --ascending > /mnt/c/temp/a.out ; wc -l /mnt/c/temp/a.out
-->

Expected behavior

The command should write the output of the calibredb command to the file a.out each time and result in a.out containing 3806 lines on each invocation.

Actual behavior

The number of lines written to a.out varies on each invocation of the command as can be seen in screenshot 1.

Other information

If I pipe the output to the wc command instead of writing to a file the output is 3806 every time, as expected. See screenshot 2.

/mnt/c/Program\ Files\ (x86)/Calibre2/calibredb.exe --with-library http://localhost:8080/#Calibre_Library list -s "vl:Unread" -f "id" --sort-by id --ascending | wc -l

Screenhot 1
Screenhot 2

@bobf32
Copy link
Author

bobf32 commented Jul 23, 2020

Update: I have rolled back my WSL instance from WSL2 to WSL1 and can confirm that this problem only manifests in the WSL2 instance.

@therealkenc
Copy link
Collaborator

Ref #4082 which has an evens chance of being the same. The one line submitted above is not a repro.

@bobf32
Copy link
Author

bobf32 commented Sep 18, 2020

So I had one day when this worked, but now the original construct is back to producing random truncated output:

/mnt/c/path/to/windows.exe > /mnt/c/temp.a.out

whereas the truncation does not seem to occur with:

/mnt/c/path/to/windows.exe > ~/a.out

Copy link
Contributor

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants