Repository navigation
Description
Version
Microsoft Windows [Version 10.0.19043.1586]
WSL Version
- WSL 2
- WSL 1
Kernel Version
4.4.0-19041-Microsoft
Distro Version
Ubuntu 20.04.4 LTS
Other Software
recode 3.7.12
https://github.com/rrthomas/recode/
Repro Steps
recode is a utility for converting text files to different encodings
when run from WSL on a file stores on a Windows-type filesystem (NTFS / FAT32 / exFAT) some serious issues are encountered
I filed this bug yesterday on the recode repo so ref it for more info:
I was initially using recode 3.6, the version packaged by Ubuntu, and it broke with exFAT and NTFS but worked properly with FAT32
I then tried current version 3.7, which broke on exFAT and FAT32 but worked properly on NTFS
Replication is easy, just run recode on a file stored on a mounted Windows filesystem such as
recode utf8..utf16 /mnt/g/test.txt
A temporary file will be created with the desired conversion done properly, and the original file will be deleted, however, it will somehow fail to rename the temporary file back to the original filename
Expected Behavior
Program should create a temporary file with the requested conversion done and then rename the temporary file back to the original filename
Actual Behavior
Original file is deleted but the temporary file is not renamed back to the original filename
The data technically isn't lost but all affected files will end up with meaningless *.tmp filenames, and if you didn't keep track of the original filenames getting them renamed back properly can be difficult or impossible, especially if you converted a lot of files and can't easily identify which .tmp file correlates with which original file (the error message in 3.7 helps with this somewhat assuming you still have access to the output)
Diagnostic Logs
:/mnt/d$ recode --version
recode 3.7.12
Written by François Pinard <[email protected]>.
Copyright (C) 1990-2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
:/mnt/d$ echo HELLO > testing.txt
:/mnt/d$ file testing.txt
testing.txt: ASCII text
:/mnt/d$ uchardet testing.txt
ASCII
:/mnt/d$ recode utf8..utf16 testing.txt
/home/username/bin/.libs/recode: rename (/mnt/d/recode-ALN8Z9.tmp, /mnt/d/testing.txt): No such file or directory
:/mnt/d$ ls -l testing.txt
ls: cannot access 'testing.txt': No such file or directory
:/mnt/d$ ls -l *.tmp
-rwxrwxrwx 1 root root 60 Mar 28 09:02 rec10721.tmp
-rwxrwxrwx 1 root root 47307 Mar 28 01:27 rec5097.tmp
-rwxrwxrwx 1 root root 14 Mar 28 09:52 recode-ALN8Z9.tmp
:/mnt/d$ file recode-ALN8Z9.tmp
recode-ALN8Z9.tmp: Big-endian UTF-16 Unicode text
:/mnt/d$ uchardet recode-ALN8Z9.tmp
UTF-16
:/mnt/d$
Activity
catharsis71 commentedon Mar 28, 2022
This apparently only happens under WSL, not when accessing a FAT32 filesystem under a native Linux OS.
microsoft-github-policy-service commentedon Feb 1, 2024
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!