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

Error when running ls -la: thread 'main' panicked at 'assertion failed #8769

Open
llagerlof opened this issue Apr 6, 2023 · 11 comments
Open
Labels
🐛 bug Something isn't working file-system Related to commands and core nushell behavior around the file system panic

Comments

@llagerlof
Copy link

Describe the bug

Inside nushell (0.78.0), the error below are happening when I issue the command ls -la:

thread 'main' panicked at 'assertion failed: tv_nsec >= 0 && tv_nsec < NSEC_PER_SEC as i64', library/std/src/sys/unix/time.rs:69:9

How to reproduce

  1. Enter nu
  2. Run the command ls -la

Expected behavior

List all files and directories inside the current directory.

Screenshots

No response

Configuration

| key                | value                                                      |
| ------------------ | ---------------------------------------------------------- |
| version            | 0.78.0                                                     |
| branch             |                                                            |
| commit_hash        |                                                            |
| build_os           | linux-x86_64                                               |
| build_target       | x86_64-unknown-linux-gnu                                   |
| rust_version       | rustc 1.68.0 (2c8cc3432 2023-03-06) (Fedora 1.68.0-1.fc36) |
| cargo_version      | cargo 1.68.0                                               |
| build_time         | 2023-04-06 08:51:34 -03:00                                 |
| build_rust_channel | release                                                    |
| features           | default, zip                                               |
| installed_plugins  |                                                            |

Additional context

  • Fedora 36
  • Running nushell inside bash 5.2.15
  • Kernel 6.2.8
@fdncred
Copy link
Collaborator

fdncred commented Apr 6, 2023

Looks like you have a file with an incorrect time maybe? We should handle this better though.

@llagerlof
Copy link
Author

Hmmm. Let's see, this is the file size and date/time columns of ls -la output using bash. Looks normal to me. Maybe the problem is another thing. nushell's ls -la works inside others directories.

     141 Jan 19  2022  
      18 Jan 19  2022  
       6 May 27  2022  
      62 Jun 17  2022  
       0 Jul 23  2022  
       0 Jul 23  2022  
      10 Jul 23  2022  
      24 Jul 23  2022  
      38 Jul 23  2022  
     492 Jul 24  2022  
    3248 Jul 24  2022  
    1394 Jul 24  2022  
    2166 Jul 24  2022  
    1672 Jul 25  2022  
       0 Jul 31  2022  
     174 Aug  1  2022  
      22 Aug  1  2022  
      28 Aug  9  2022  
      94 Aug 10  2022  
      92 Aug 13  2022  
     178 Aug 14  2022  
     322 Aug 16  2022  
     412 Aug 22  2022  
     190 Aug 22  2022  
     106 Aug 25  2022  
      28 Aug 29  2022  
     116 Aug 29  2022  
      10 Sep  1  2022  
     286 Sep  1  2022  
      74 Sep  2  2022  
    1194 Sep  4  2022  
     590 Sep  5  2022  
     164 Sep 11  2022  
     155 Sep 13  2022  
      92 Sep 14  2022  
     443 Sep 15  2022  
   49580 Sep 16  2022  
      23 Sep 16  2022  
    2377 Sep 16  2022  
       0 Sep 20  2022  
     326 Sep 20  2022  
     448 Sep 21  2022  
       2 Sep 21  2022  
     151 Sep 23  2022  
      62 Sep 26  2022  
      12 Sep 26  2022  
     100 Sep 27  2022  
      66 Oct  3  2022  
      16 Oct  3  2022  
     390 Oct  4  2022  
     610 Oct  4  2022  
     114 Oct  4  2022  
    1403 Oct  7 17:37  
      48 Oct 11 13:17  
      38 Oct 15 19:23  
       0 Oct 17 08:25  
     360 Oct 21 10:23  
      96 Oct 21 19:34  
      76 Oct 29 19:28  
     423 Nov  2 19:35  
     140 Nov  3 08:54  
      12 Nov  3 11:47  
     302 Nov  4 17:06  
       0 Nov 18 20:08  
     172 Nov 22 13:16  
      60 Nov 27 14:27  
      60 Dec  4 09:59  
     745 Dec  4 09:59  
      10 Dec  4 10:02  
     934 Dec  5 10:49  
      32 Dec  7 12:02  
   14001 Dec 15 21:55  
      34 Dec 19 15:10  
     362 Dec 19 16:22  
     126 Dec 20 09:02  
      44 Dec 22 15:11  
     444 Dec 23 15:47  
      36 Dec 26 14:27  
     633 Dec 26 23:28  
      10 Jan  3 18:38  
      46 Jan  3 18:39  
       0 Jan  4 12:30  
   10126 Jan  4 13:16  
     116 Jan  5 08:45  
       3 Jan  7 15:28  
      87 Jan  7 15:29  
       8 Jan  8 21:04  
      20 Jan 10 17:37  
      14 Jan 10 17:37  
 7722253 Jan 11 09:35  
     445 Jan 13 16:07  
     632 Jan 13 17:32  
      18 Jan 17 16:21  
      20 Jan 21 09:38 
     138 Jan 22 19:57  
      88 Jan 22 20:16  
      88 Jan 23 08:39  
       0 Jan 25 13:14  
       0 Jan 26 09:11  
    7071 Jan 26 09:11  
     416 Jan 26 09:13  
     543 Jan 26 10:14  
   25032 Jan 26 10:15  
     360 Jan 26 10:18  
      14 Jan 30 08:17  
     483 Jan 30 08:39  
     904 Jan 30 08:43  
   25120 Jan 30 08:43  
      28 Jan 30 12:09  
      54 Jan 30 14:15  
    1024 Jan 30 14:20  
    1206 Jan 30 17:52  
     163 Jan 30 18:03  
     217 Jan 31 15:29  
       7 Feb  1 13:39  
     102 Feb  1 17:18  
      12 Feb  3 15:09  
     102 Feb  7 09:37  
     110 Feb  7 10:50  
      20 Feb  7 12:16  
      90 Feb 15 09:08  
     624 Feb 15 10:28  
      16 Feb 22 16:09  
     172 Feb 22 18:10  
      30 Mar  1 21:12  
    1732 Mar 13 11:07  
      86 Mar 21 14:33  
     563 Mar 22 11:15  
      16 Mar 22 12:48  
      20 Mar 22 12:48  
      96 Mar 26 10:13  
     598 Mar 27 08:30  
     126 Mar 28 09:07  
     146 Mar 29 23:39  
     178 Apr  3 13:02  
    1856 Apr  3 13:02  
    4280 Apr  3 17:24  
    5591 Apr  4 10:07  
    9252 Apr  4 13:04  
      28 Apr  4 16:11  
   11821 Apr  4 19:07  
   24394 Apr  5 08:51  
     316 Apr  5 18:21  
       0 Apr  5 18:21  
       0 Apr  6 05:00  
      33 Apr  6 07:35  
      31 Apr  6 07:35  
     148 Apr  6 07:35  
   31950 Apr  6 10:21  
     890 Apr  6 11:28  
    2578 Apr  6 12:03  
   10830 Apr  6 14:34  
   10335 Apr  6 14:56  
   17277 Apr  6 15:00  
   21489 Apr  6 15:02  
    3218 Apr  6 15:02  
   23313 Apr  6 15:10  
     100 Apr  6 15:11  
    6969 Apr  6 15:21  
    5034 Apr  6 15:24  

@fdncred
Copy link
Collaborator

fdncred commented Apr 6, 2023

looks normal to me ...

LOL. I don't think bash is written in rust so it doesn't uss the same crate source code such as library/std/src/sys/unix/time.rs. so it's not a good comparison. The error is pretty clear that this is the error tv_nsec >= 0 && tv_nsec < NSEC_PER_SEC as i64, so whatever a particular file is returning in tv_nsec, that is referenced in time.rs is the problem.

Someone may be able to fix this in the nushell source but it could also be an upstream problem as well, I'm not sure.

Without having a file that produces these errors, it'll be hard to fix though.

@llagerlof
Copy link
Author

llagerlof commented Apr 6, 2023

After some tests I found out the problematic directory. It's the ~/.config/microsoft-edge/.

I don't know why, but nushell fails when tries to read some info from this directory. This problem happens too in some files and contents of this directory.

Here is the stat of microsoft-edge directory, if helps:

File: microsoft-edge
Size: 1200 Blocks: 0 IO Block: 4096 directory
Device: 0,36 Inode: 10103887 Links: 1
Access: (0700/drwx------) Uid: ( 1000/lawrence) Gid: ( 1000/lawrence)
Context: unconfined_u:object_r:config_home_t:s0
Access: 2023-04-06 19:53:14.974066209 -0300
Modify: 2023-04-06 19:53:14.944065809 -0300
Change: 2023-04-06 19:53:14.944065809 -0300
Birth: 2023-02-15 10:27:21.725064946 -0300

edit: @fdncred is right about the microsoft-edge directory. This wasn't the culprit.

@sholderbach sholderbach added 🐛 bug Something isn't working file-system Related to commands and core nushell behavior around the file system labels Apr 6, 2023
@fdncred
Copy link
Collaborator

fdncred commented Apr 7, 2023

I don't think it's the directory that's causing the problems. There is probably 1 file with a messed up access, modify, change, or birth date that is funky that is causing library/std/src/sys/unix/time.rs to have problems.

@llagerlof
Copy link
Author

llagerlof commented Apr 7, 2023

I have problematic files. Like this one:

/home/lawrence/.config/microsoft-edge/.com.microsoft.Edge.po5oP5

  File: .com.microsoft.Edge.po5oP5
  Size: 70393     	Blocks: 144        IO Block: 4096   regular file
Device: 0,36	Inode: 11748228    Links: 1
Access: (0600/-rw-------)  Uid: ( 1000/lawrence)   Gid: ( 1000/lawrence)
Context: unconfined_u:object_r:config_home_t:s0
Access: 2023-03-22 12:04:17.415224118 -0300
Modify: 2023-03-22 12:04:17.415224118 -0300
Change: 2023-03-22 12:04:17.415224118 -0300
 Birth: -2277462116914351304.-1238932531

How do I know? Because inside nushell ls -lsa .com.microsoft.Edge.po5oP5 causes the crash too. Looks like you are correct. The birth date is an integer in this one.

Other problematic file, for comparisson:

/home/lawrence/.config/microsoft-edge/Default/EdgePushStorageWithConnectTokenAndKey/000003.log

  File: 000003.log
  Size: 2600235   	Blocks: 5080       IO Block: 4096   regular file
Device: 0,36	Inode: 10105164    Links: 1
Access: (0600/-rw-------)  Uid: ( 1000/lawrence)   Gid: ( 1000/lawrence)
Context: unconfined_u:object_r:config_home_t:s0
Access: 2023-04-03 12:06:43.871730477 -0300
Modify: 2023-04-03 12:06:49.259801145 -0300
Change: 2023-04-03 12:06:49.259801145 -0300
 Birth: 8679965255892022840.1970169645

And a good file:

/home/lawrence/.config/microsoft-edge/Default/EdgePushStorageWithConnectTokenAndKey/MANIFEST-000001

  File: MANIFEST-000001
  Size: 41        	Blocks: 8          IO Block: 4096   regular file
Device: 0,36	Inode: 10105162    Links: 1
Access: (0600/-rw-------)  Uid: ( 1000/lawrence)   Gid: ( 1000/lawrence)
Context: unconfined_u:object_r:config_home_t:s0
Access: 2023-04-03 12:06:43.846730149 -0300
Modify: 2023-02-15 10:29:02.725329393 -0300
Change: 2023-02-15 10:29:02.725329393 -0300
 Birth: 2023-02-15 10:29:02.725329393 -0300

@llagerlof
Copy link
Author

And just for completeness, my .config dir has an integer as birth date too. I'ts because of this directory that listing the insides of my $HOME dir was crashing nushell.

@fdncred
Copy link
Collaborator

fdncred commented Apr 7, 2023

I think you've put your finger on what the issue is but it's going to take someone, like yourself, with those messed up dates, to try and make nushell's ls code behave and not panic in those situations.

@llagerlof
Copy link
Author

llagerlof commented Apr 7, 2023

Thanks. I found out the Rust devs are already aware of this problem.

rust-lang/rust#108277

@weirdan
Copy link
Contributor

weirdan commented Aug 18, 2024

The upstream bug has been fixed in 1.78.0 (the minimum version nushell builds with now). @llagerlof would you mind testing with a fresh nushell version?

@llagerlof
Copy link
Author

@llagerlof would you mind testing with a fresh nushell version?

Unfortunately I don't have access to that filesystem anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working file-system Related to commands and core nushell behavior around the file system panic
Projects
None yet
Development

No branches or pull requests

4 participants