lsd icon indicating copy to clipboard operation
lsd copied to clipboard

"cannot access '.'" error on Windows

Open thorstenkampe opened this issue 4 years ago • 14 comments

Installed from the latest master branch commit:

  • on a substituted drive:
C:\Users\thorsten\.cargo\bin\lsd.exe
cannot access '.': The access control list (ACL) structure is invalid. (os error 1336)
  • on C:
C:\Users\thorsten\.cargo\bin\lsd.exe
cannot access '.': The specified domain either does not exist or could not be contacted. (os error 1355)

thorstenkampe avatar Mar 08 '20 13:03 thorstenkampe

On further inspection, this seems to be bug in relation to files created in a Cygwin environment on Windows

  • native Windows: okay
> New-Item -Name test-win.txt -ItemType File | Out-Null
> lsd --long --icon=never test-win.txt
.rwx------ VORDEFINIERT\Administratoren REDNAILS\Kein 0 B Sun Jun 21 13:50:16 2020 test-win.txt
  • Cygwin: not okay
> touch test-cyg.txt
> lsd --long --icon=never test-cyg.txt
lsd: .\test-cyg.txt: The access control list (ACL) structure is invalid. (os error 1336)
  • show difference between the two files
> ls -Al
total 40
-rw-rw-r--+ 1 thorsten        Kein 0 Jun 21 13:52 test-cyg.txt
-rwxrwx---+ 1 Administratoren Kein 0 Jun 21 13:50 test-win.txt

Owner (thorsten vs Administratoren) and permissions (664 vs 770) differ. We give the group (Kein/None) execute permission.

Now it works:

> chmod g+x test-cyg.txt
> lsd --long --icon=never test-cyg.txt
.rwxrwxrwx REDNAILS\thorsten REDNAILS\Kein 0 B Sun Jun 21 13:52:10 2020 test-cyg.txt

thorstenkampe avatar Jun 21 '20 12:06 thorstenkampe

If lsd is unable to parse file's ACL created under the same user, this is a bug in lsd. Cygwin creates correct ACE's. Non-canonical, yes, but they are correct ACE's according to the specification.

"+" at the end of POSIX permissions mask means you have to use tools such as getfacl (or native icacls) to explore actual permissions. POSIX simple mask is merely an approximation in such case.

Also, the fact your files have different owners suggests that you actually running your Windows code under Administrator user, not your current user.

AnrDaemon avatar Jun 22 '20 17:06 AnrDaemon

  • lsd reports an OS error (os error 1336). Whether that directly refers to the ACL or to what lsd would like to do is something I cannot tell, yet I accept your view.

  • Administratoren is actually a group ("administrators"). PowerShell's New-Item assigns ownership to the group while Cygwin's touch makes the user the owner. That's standard behaviour.

Anyway, I'd love to see it fixed.

thorstenkampe avatar Jun 22 '20 17:06 thorstenkampe

I am also having this error, but have not used Cygwin for a very long time. I do not have to be using a mapped drive for this to happen. Any time I invoke lsd (ver 0.17.0) under pwsh (ver 7.0.3), Powershell (ver 5.1.18362.752), or even cmd (ver 10.0.18362.959 with clink ver 0.4.9), I get this exact error message:

lsd: .: The specified domain either does not exist or could not be contacted. (os error 1355)

Any fix yet?

sql-sith avatar Aug 10 '20 02:08 sql-sith

This means, one of your your object's ACE refer to a SID that cannot be resolved at the moment.

Perhaps, the disk was used in(with?) a different domain previously (you reinstalled the OS?).

AnrDaemon avatar Aug 10 '20 10:08 AnrDaemon

I am experiencing similar issues. Like @sql-sith, I have Cygwin installed but have not used it in years. Would uninstalling Cygwin correct the problem?

The output I am getting is:

lsd: .\dev: The access control list (ACL) structure is invalid. (os error 1336).

lsd: .\dircolors-solarized: The access control list (ACL) structure is invalid. (os error 1336).

lsd: .\dotfiles: The access control list (ACL) structure is invalid. (os error 1336).

lsd: .\Homestead: The access control list (ACL) structure is invalid. (os error 1336).

lsd: .\karlin-mintty-colors-solarized: The access control list (ACL) structure is invalid. (os error 1336).

lsd: .\mavnn-mintty-colors-solarized: The access control list (ACL) structure is invalid. (os error 1336).

I recognize these directories as ones that I created a long time ago, probably back when I used Cygwin. I don't know from where lsd is reading these, but I'd like it to stop, if at all possible.

SturmB avatar Mar 08 '21 16:03 SturmB

@SturmB , no, your error is due to lsd bug. See https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-files

AnrDaemon avatar Mar 09 '21 04:03 AnrDaemon

Oh, so uninstalling Cygwin won't help either, eh? That's a shame. Well, I certainly hope there will be a bug fix for this someday. Thanks for the info, @AnrDaemon.

SturmB avatar Mar 09 '21 15:03 SturmB

I'm having the same error code 1336 as well. I installed lsd via scoop install lsd.

Here's me trying out lsd in 4 shells but to no avail:

4TerminalsSame

Then here's WSL2 (I"m using Cmder):

ws2Working

WSL2 works because I installed it via sudo dpkg -i lsd_0.20.1_amd64.deb

More info:

mintty 3.4.7 (x86_64-pc-cygwin) [Windows 19042]

Hope it's useful.

kohane27 avatar Mar 23 '21 02:03 kohane27

What made you think that different shell could make results different? The problem in the lsd itself. In case of WSL2, the directory is network mounted and its ACL entries are likely mangled. Or Linux lsd is not making the same checks as Windows one.

AnrDaemon avatar Mar 23 '21 07:03 AnrDaemon

Any updates on this? Works fine in Power Shell 7.1 and Cygwin64, but getting (os error 1336) on git bash terminal.

azemii avatar Aug 01 '22 22:08 azemii

HI guys, the same thing happens to me, any workaround?

hologramrp avatar Feb 29 '24 23:02 hologramrp

Hi @hologramrp and others meet this error, we have introduced a new permission mode, --permission attributes in windows, this might help, could you try the newly released v1.1.1

zwpaper avatar Mar 23 '24 16:03 zwpaper

Bonjour @zwpaper and folks! how are you guys? Hope it doing good ;)

YEAH, now it's working, thanks!

Actually just updating was not enough, I had to clean my previous instalations. So, because I installed via cargo, winget and scoop, First I was needed to do in terminal:

winget remove --id lsd-rs.lsd scoop uninstall lsd cargo uninstall lsd

After then, I install the newly version from the master branch.

cargo install --git https://github.com/lsd-rs/lsd.git --branch master

Close the terminal, and open again and it works ; )

(Using Powershell 7.4.1, on a Windows 11 Pro, Version: 22H2)

working

hologramrp avatar Mar 25 '24 17:03 hologramrp