-
Notifications
You must be signed in to change notification settings - Fork 18
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
Remove trailing whitespaces from driver when converting #8
Comments
@joaopluigi Thanks for your report. I am also curious why there are extra white characters. Can you report some information to here too:
By the way, I may reply later because of my work. |
And I guess the problem is caused by function function get_mounted_drvfs() {
# region need-to-be-replaced-in-unit-test
# The previous line is used for mark the following statments
# need to be replaced to other implementation for unit test (travis-CI)
mount -t drvfs | awk '{
if(split($0, lr, "type drvfs") < 2) next;
if(split(lr[1], part, "on") < 2) next;
drive = part[1]; gsub(/^\s/, "", drive); gsub(/\s$/, "", drive);
mount_to = part[2]; gsub(/^\s/, "", mount_to); gsub(/\s$/, "", mount_to);
print toupper(drive) "\n" mount_to;
}';
# endregion need-to-be-replaced-in-unit-test
} Maybe the |
Thanks for the answer! These are the info you asked for:
Windows version: 1809 (I'm pretty sure I was getting this error on 1803 also) |
@joaopluigi And could you report the output of following command to here to, thanks awk --version Because I found a Q&A on the StackOverflow:
https://stackoverflow.com/questions/29512854/how-to-define-a-space-in-a-regular-expression-in-awk |
Ok, my
|
And you can try replace the implement of function function get_mounted_drvfs() {
# region need-to-be-replaced-in-unit-test
# The previous line is used for mark the following statments
# need to be replaced to other implementation for unit test (travis-CI)
mount -t drvfs | awk '
function trim(s) { gsub(/^[[:space:]]+/, "", s); gsub(/[[:space:]]+$/, "", s); return s; }
{
if(split($0, lr, "type drvfs") < 2) next;
if(split(lr[1], part, "on") < 2) next;
drive = trim(part[1]); mount_to = trim(part[2]);
print toupper(drive) "\n" mount_to;
}';
# endregion need-to-be-replaced-in-unit-test
} And try again, It maybe working fine for you. @joaopluigi |
This solution did not work @hangxingliu |
@joaopluigi Have you updated that And the reason why don't replace space characters after P.s. And my next reply will be appear in here after a few hours. I have to take a nap |
I did the change directly on
You're right. I agree
Haha go for it, get some rest |
@joaopluigi Sorry for reply late. (I am busying on the work and graduation thesis recently) And i found the the root of problem about this issue in my scripts. and I will fix it in the latest commit. The root of problem are:
I will be grateful if you can give me a feedback of my latest commit for fix this issue. |
It worked just fine! Thanks for that |
Hey there,
I had some problems when trying to update my
wslgit.sh
to the last version2019-02-08
. Debugging it, I found that my variableMOUNTED_DRVFS
was getting some trailing whitespaces when splitted onmount_len = split(_mount, mount_list, "\n");
. For that reason, the result of, for example,to_unix_path_by_awk
function would be something like:Which was leading to error.
I solved by removing the whitespaces using
gsub
onawk
I'm not sure if this was the correct approach. Also, I don't know why I was getting the trailing spaces.
See my changes on: https://github.com/hangxingliu/wslgit/compare/master...joaopluigi:fix/convertion-whitespace?expand=1
The text was updated successfully, but these errors were encountered: