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

[BUG] macchina-5.0.4 nearly broken on NetBSD #217

Closed
0323pin opened this issue Nov 11, 2021 · 45 comments
Closed

[BUG] macchina-5.0.4 nearly broken on NetBSD #217

0323pin opened this issue Nov 11, 2021 · 45 comments

Comments

@0323pin
Copy link

0323pin commented Nov 11, 2021

Hi guys,
Here we go again,

/home/pin()
2021-11-11 11:00 > macchina -v
macchina    5.0.4
libmacchina 3.8.1
/home/pin()
2021-11-11 11:00 > macchina
                                                                                        
 \\`-______,----__      Machine     -  Hewlett-Packard HP EliteBook 820 G1 A3009DD10303
  \\        __,---`.    OS          -  NetBSD 9.99.92                                   
   \\       `.____      Packages    -  185 (pkgsrc)                                     
    \\-______,----`.    Terminal    -  xterm                                            
     \\                 Uptime      -  2h 9m                                            
      \\                CPU         -  Intel® Core™ i5-4210U CPU @ 1.70GHz (4)          
       \\               Brightness  -  100%                                             
        \\              CPU Load    -  3%                                               
         \\             Memory      -  1.2 GB/7.5 GB                                    
          \\            Battery     -  Full                                             
           \\                                                                           

/home/pin()
2021-11-11 11:00 > macchina -d
Let's check your system for errors... Here's a summary:

We've collected 18 readouts, including 6 failed read(s) and 2 read(s) which resulted in a warning.
Readout "Host" failed with message: Unable to read account information.
Readout "DesktopEnvironment" failed with message: You appear to be only running a window manager.
Readout "WindowManager" failed with message: No graphical session detected.
Readout "LocalIP" failed with message: Please specify a network interface to query (e.g. `interface = "wlan0"` in macchina.toml).
Readout "Shell" failed with message: Unable to read account information.
Readout "Resolution" failed with message: Metric is not available on this system.

2 of the 8 unsuccessful read(s) resulted in a warning:
Readout "Kernel" threw a warning with message: This information is provided by the OperatingSystem readout on NetBSD.
Readout "Distribution" threw a warning with message: This information is provided by the OperatingSystem readout on NetBSD.
/home/pin()
2021-11-11 11:00 > 

Forget about "LocalIP", this is simply because I didn't specify the interface but, failed to fetch "Host", "WindowManager" and "Shell"?

EDIT: @grtcdr I think is better not to merge this release and let users stay on 5.0.3 for now.

@0323pin 0323pin added the bug label Nov 11, 2021
@grtcdr
Copy link
Member

grtcdr commented Nov 11, 2021

I think is better not to merge this release and let users stay on 5.0.3 for now.

I guess so.

I'm unsure what change screwed up all these readouts.

I have a question about the WindowManager readout, in our latest version of libmacchina, we introduced a new module, winman.rs. We also made some small changes to the window_manager() function within the shared crate.

With the latest changes, window_manager() has become dependent on the output of the session() function. session() basically returns the output of XDG_SESSION_TYPE with the first letter uppercased. Can you tell me the output of XDG_SESSION_TYPE?

@0323pin
Copy link
Author

0323pin commented Nov 11, 2021

@grtcdr I'll get back to you with the output on NetBSD but, I guess this will cause trouble elsewhere.
As I happen to be on my Linux machine, here is the output from it,

$ echo $XDG_SESSION_TYPE
tty

In other words, not very useful.

@0323pin
Copy link
Author

0323pin commented Nov 11, 2021

@grtcdr Ok, here's from NetBSD,

┌─────────────[2021-11-11 19:38] pin@mybox
│~ 
└─> echo $XDG_SESSION_TYPE
error: Variable not in scope
  ┌─ shell:1:6
  │
1 │ echo $XDG_SESSION_TYPE
  │      ^^^^^^^^^^^^^^^^^ unknown variable: $XDG_SESSION_TYPE

┌─────────────[2021-11-11 19:40] pin@mybox
│~ 
└─> 

Why using this now? I mean, why changing to freedesktop/RedHat XDG implementation?
What about "Host" and "Shell"?

@grtcdr
Copy link
Member

grtcdr commented Nov 11, 2021

I decided it was time to start supporting Wayland compositors so the only way I could do that was to check the session type before proceeding to check which compositor/window manager is running.

What's wrong with the XDG spec?

Is there any other variable that we can use that exists on NetBSD?

What about "Host" and "Shell"?

Not sure, but we recently updated the libc dependency version so maybe that could be the culprit.

@grtcdr
Copy link
Member

grtcdr commented Nov 11, 2021

AFAIK, Wayland support for NetBSD still hasn't landed, so we'll skip checking the output of session() on NetBSD.

@0323pin
Copy link
Author

0323pin commented Nov 11, 2021

I decided it was time to start supporting Wayland compositors

Fair enough.

What's wrong with the XDG spec?

Well, as you could see from the output on my Linux machine, it's not universal. Which, is fine but, let's not pretend it is.
And, yes my linux machine runs just a WM (Awesome) but, it has elogind as seat-manager.

Not sure, but we recently updated the libc dependency version so maybe that could be the culprit.

Weird!? Are you sure you didn't touch the logics of those readouts?

Is there any other variable that we can use that exists on NetBSD?
AFAIK, Wayland support for NetBSD still hasn't landed, so we'll skip checking the output of session() on NetBSD.

It has but, not in the way you are used to. The only WM available is velox and swc the only compositor. I have used it myself and it works but, you could hardly call it stable. wlroots won't happen in the near future.

@grtcdr
Copy link
Member

grtcdr commented Nov 11, 2021

Well, as you could see from the output on my Linux machine, it's not universal. Which, is fine but, let's not pretend it is.

My apologies, I really thought most of if not all of the XDG spec was shared between every *nix machine.

Weird!? Are you sure you didn't touch the logics of those readouts?

Nope, I haven't touched the username() implementation in ages.

It has but, not in the way you are used to. The only WM available is velox and swc the only compositor. I have used it myself and it works but, you could hardly call it stable. wlroots won't happen in the near future.

That sucks, I've been enjoying Wayland a lot recently, and the security issues it addresses seem like a step forward for *nix as a whole.

@grtcdr
Copy link
Member

grtcdr commented Nov 11, 2021

Anyways, I've bumped libc and addressed this issue, I'll power on my VM and try it out.

@0323pin
Copy link
Author

0323pin commented Nov 11, 2021

Nope, I haven't touched the username() implementation in ages.

Ok, thanks!

My apologies, I really thought most of if not all of the XDG spec was shared between every *nix machine.

No worries, I don't run typical systems. NetBSD respects XDG DIRS but, doesn't force them on you.

That sucks, I've been enjoying Wayland a lot recently ...

I understand that but, it's well over my head to port this and it looks like it won't be happening soon.

Anyways, I've bumped libc and addressed this issue, I'll power on my VM and try it out.

Thanks, I've seen your commits now :)
Fast work!

@grtcdr
Copy link
Member

grtcdr commented Nov 11, 2021

No worries, I don't run typical systems. NetBSD respects XDG DIRS but, doesn't force them on you.

Oh, got it.

I understand that but, it's well over my head to port this and it looks like it won't be happening soon.

Yeah, it doesn't seem trivial whatsoever.

Thanks, I've seen your commits now :)

Of course, although I still can't seem to build macchina on my NetBSD VM due to that pesky "linker 'cc' not found" error.

@0323pin
Copy link
Author

0323pin commented Nov 11, 2021

Of course, although I still can't seem to build macchina on my NetBSD VM due to that pesky "linker 'cc' not found" error.

As usual, create a beta-branch and I can test this for you. Although, it won't be possible before tomorrow morning.

I believe the error you are facing it's because you are building outside pkgsrc. Rust needs the c-toolchain to link and it doesn't find it.

Do these last changes remove dependency on wmctrl? Got the answer by reading the code in winman.rs :)

@grtcdr
Copy link
Member

grtcdr commented Nov 11, 2021

As usual, create a beta-branch and I can test this for you. Although, it won't be possible before tomorrow morning.

The newest changes have already been pushed to the main branch, so I guess compile and run from there when you have the time.

I believe the error you are facing it's because you are building outside pkgsrc. Rust needs the c-toolchain to link and it doesn't find it.

:( I'm beginning to lose it with Rust and Pkgsrc.

@0323pin
Copy link
Author

0323pin commented Nov 11, 2021

@grtcdr No worries, I'll build it from git-HEAD first thing in the morning 😴

@0323pin 0323pin closed this as completed Nov 11, 2021
@grtcdr
Copy link
Member

grtcdr commented Nov 11, 2021

Great, thank you :) and sorry for the trouble!

@0323pin
Copy link
Author

0323pin commented Nov 12, 2021

@grtcdr Why was this issue closed?

@0323pin 0323pin reopened this Nov 12, 2021
@0323pin
Copy link
Author

0323pin commented Nov 12, 2021

@grtcdr Anyway, the good news first, "WindowManager" is back, thank you. As usual forget about "LocalIP", it works fine if I enable it but, ...

/home/pin()
2021-11-12 07:15 > macchina -v
macchina    5.0.5
libmacchina 3.8.5
/home/pin()
2021-11-12 07:15 > macchina
                                                                                        
 \\`-______,----__      Machine     -  Hewlett-Packard HP EliteBook 820 G1 A3009DD10303
  \\        __,---`.    OS          -  NetBSD 9.99.92                                   
   \\       `.____      WM          -  Franken                                          
    \\-______,----`.    Packages    -  185 (pkgsrc)                                     
     \\                 Terminal    -  xterm                                            
      \\                Uptime      -  47m                                              
       \\               CPU         -  Intel® Core™ i5-4210U CPU @ 1.70GHz (4)          
        \\              Brightness  -  100%                                             
         \\             CPU Load    -  9%                                               
          \\            Memory      -  841.4 MB/7.5 GB                                  
           \\           Battery     -  97% & Charging                                   

/home/pin()
2021-11-12 07:15 > macchina -d
Let's check your system for errors... Here's a summary:

We've collected 18 readouts, including 5 failed read(s) and 2 read(s) which resulted in a warning.
Readout "Host" failed with message: Unable to read account information.
Readout "DesktopEnvironment" failed with message: You appear to be only running a window manager.
Readout "LocalIP" failed with message: Please specify a network interface to query (e.g. `interface = "wlan0"` in macchina.toml).
Readout "Shell" failed with message: Unable to read account information.
Readout "Resolution" failed with message: Metric is not available on this system.

2 of the 7 unsuccessful read(s) resulted in a warning:
Readout "Kernel" threw a warning with message: This information is provided by the OperatingSystem readout on NetBSD.
Readout "Distribution" threw a warning with message: This information is provided by the OperatingSystem readout on NetBSD.
/home/pin()
2021-11-12 07:15 > 

"Host" and "Shell" are still missing 😢

Looking at v5.0.3 it has libc v0.2.104, I wonder what regression cause this going to libc v0.2.107 ? I'll see if I can find it.

@0323pin
Copy link
Author

0323pin commented Nov 12, 2021

...libc v0.2.104 ... to libc v0.2.107 ... I'll see if I can find it.

Looking at the commits, I only see added functionality, which is good as it increases support.
@grtcdr can you help me here? What calls are you using and what should I be looking for?

@grtcdr
Copy link
Member

grtcdr commented Nov 12, 2021

Okay, so we're using libc::geteuid() and libc::getpwuid() in the username method. And since the Host readout is failing because username is failing, we can focus on that.

The Shell readout also fails due to the same reason, as it shares some of the same logic as the username() method.

@0323pin
Copy link
Author

0323pin commented Nov 12, 2021

@grtcdr Could this be it?

diff -u ./libc-0.2.107/src/unix/mod.rs ./libc-0.2.104/src/unix/mod.rs

--- ./libc-0.2.107/src/unix/mod.rs	2021-11-07 02:55:35.000000000 +0100
+++ ./libc-0.2.104/src/unix/mod.rs	2021-10-16 07:55:09.000000000 +0200
@@ -305,21 +305,21 @@
     } else if #[cfg(all(target_os = "linux",
                         any(target_env = "gnu", target_env = "uclibc"),
                         feature = "rustc-dep-of-std"))] {
-        #[link(name = "util", kind = "static", modifiers = "-bundle",
+        #[link(name = "util", kind = "static-nobundle",
             cfg(target_feature = "crt-static"))]
-        #[link(name = "rt", kind = "static", modifiers = "-bundle",
+        #[link(name = "rt", kind = "static-nobundle",
             cfg(target_feature = "crt-static"))]
-        #[link(name = "pthread", kind = "static", modifiers = "-bundle",
+        #[link(name = "pthread", kind = "static-nobundle",
             cfg(target_feature = "crt-static"))]
-        #[link(name = "m", kind = "static", modifiers = "-bundle",
+        #[link(name = "m", kind = "static-nobundle",
             cfg(target_feature = "crt-static"))]
-        #[link(name = "dl", kind = "static", modifiers = "-bundle",
+        #[link(name = "dl", kind = "static-nobundle",
             cfg(target_feature = "crt-static"))]
-        #[link(name = "c", kind = "static", modifiers = "-bundle",
+        #[link(name = "c", kind = "static-nobundle",
             cfg(target_feature = "crt-static"))]
-        #[link(name = "gcc_eh", kind = "static", modifiers = "-bundle",
+        #[link(name = "gcc_eh", kind = "static-nobundle",
             cfg(target_feature = "crt-static"))]
-        #[link(name = "gcc", kind = "static", modifiers = "-bundle",
+        #[link(name = "gcc", kind = "static-nobundle",
             cfg(target_feature = "crt-static"))]
         #[link(name = "util", cfg(not(target_feature = "crt-static")))]
         #[link(name = "rt", cfg(not(target_feature = "crt-static")))]
@@ -330,7 +330,7 @@
         extern {}
     } else if #[cfg(target_env = "musl")] {
         #[cfg_attr(feature = "rustc-dep-of-std",
-                   link(name = "c", kind = "static", modifiers = "-bundle",
+                   link(name = "c", kind = "static",
                         cfg(target_feature = "crt-static")))]
         #[cfg_attr(feature = "rustc-dep-of-std",
                    link(name = "c", cfg(not(target_feature = "crt-static"))))]
@@ -372,7 +372,7 @@
         extern {}
     } else if #[cfg(target_os = "redox")] {
         #[cfg_attr(feature = "rustc-dep-of-std",
-                   link(name = "c", kind = "static", modifiers = "-bundle",
+                   link(name = "c", kind = "static-nobundle",
                         cfg(target_feature = "crt-static")))]
         #[cfg_attr(feature = "rustc-dep-of-std",
                    link(name = "c", cfg(not(target_feature = "crt-static"))))]
@@ -699,7 +699,6 @@
         all(target_os = "freebsd", any(freebsd11, freebsd10)),
         link_name = "fstat@FBSD_1.0"
     )]
-    #[cfg_attr(target_os = "dragonfly", allow(deprecated))]
     pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int;
 
     pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int;
@@ -713,7 +712,6 @@
         all(target_os = "freebsd", any(freebsd11, freebsd10)),
         link_name = "stat@FBSD_1.0"
     )]
-    #[cfg_attr(target_os = "dragonfly", allow(deprecated))]
     pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int;
 
     pub fn pclose(stream: *mut ::FILE) -> ::c_int;
@@ -798,7 +796,6 @@
         all(target_os = "freebsd", any(freebsd11, freebsd10)),
         link_name = "fstatat@FBSD_1.1"
     )]
-    #[cfg_attr(target_os = "dragonfly", allow(deprecated))]
     pub fn fstatat(
         dirfd: ::c_int,
         pathname: *const ::c_char,
@@ -990,7 +987,6 @@
         all(target_os = "freebsd", any(freebsd11, freebsd10)),
         link_name = "lstat@FBSD_1.0"
     )]
-    #[cfg_attr(target_os = "dragonfly", allow(deprecated))]
     pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int;
 
     #[cfg_attr(

@0323pin
Copy link
Author

0323pin commented Nov 12, 2021

Or, maybe not :(

@grtcdr
Copy link
Member

grtcdr commented Nov 12, 2021

I don't know what I'm supposed to be looking for here... I don't see a single mention of NetBSD in the diff.

What interests us is these two functions:

They've worked fine for a long time for every Unix-like operating system libmacchina supports (except FreeBSD), and I find it odd that it would just stop working all of a sudden and only on NetBSD.

@0323pin
Copy link
Author

0323pin commented Nov 12, 2021

@grtcdr

I don't know what I'm supposed to be looking for here... I don't see a single mention of NetBSD in the diff.

Yeah, I've just jumped ahead and did a quick grep and diff, sorry for the noise. I'll keep looking

@grtcdr
Copy link
Member

grtcdr commented Nov 12, 2021

No worries, I'll have a closer look at what changed between libmacchina's releases. It's very unlikely that there's a bug in NetBSD's core libraries.

@0323pin
Copy link
Author

0323pin commented Nov 12, 2021

@grtcdr The thing is this is the only file that has changed on the NetBSD specific code. I only see additions, which should bring better support and nothing that could be causing this.

--- ./libc-0.2.104/src/unix/bsd/netbsdlike/netbsd/mod.rs	2021-11-12 12:27:16.410324805 +0100
+++ ./libc-0.2.107/src/unix/bsd/netbsdlike/netbsd/mod.rs	2021-11-12 12:28:06.707655069 +0100
@@ -538,6 +538,16 @@
         #[cfg(libc_union)]
         pub fae: *mut posix_spawn_file_actions_entry_t,
     }
+
+    pub struct ptrace_lwpinfo {
+        pub pl_lwpid: lwpid_t,
+        pub pl_event: ::c_int,
+    }
+
+    pub struct ptrace_siginfo {
+        pub psi_siginfo: siginfo_t,
+        pub psi_lwpid: lwpid_t,
+    }
 }
 
 s_no_extra_traits! {
@@ -1385,6 +1395,15 @@
 pub const MAP_HASSEMAPHORE: ::c_int = 0x200;
 pub const MAP_WIRED: ::c_int = 0x800;
 pub const MAP_STACK: ::c_int = 0x2000;
+// map alignment aliases for MAP_ALIGNED
+pub const MAP_ALIGNMENT_SHIFT: ::c_int = 24;
+pub const MAP_ALIGNMENT_MASK: ::c_int = 0xff << MAP_ALIGNMENT_SHIFT;
+pub const MAP_ALIGNMENT_64KB: ::c_int = 16 << MAP_ALIGNMENT_SHIFT;
+pub const MAP_ALIGNMENT_16MB: ::c_int = 24 << MAP_ALIGNMENT_SHIFT;
+pub const MAP_ALIGNMENT_4GB: ::c_int = 32 << MAP_ALIGNMENT_SHIFT;
+pub const MAP_ALIGNMENT_1TB: ::c_int = 40 << MAP_ALIGNMENT_SHIFT;
+pub const MAP_ALIGNMENT_256TB: ::c_int = 48 << MAP_ALIGNMENT_SHIFT;
+pub const MAP_ALIGNMENT_64PB: ::c_int = 56 << MAP_ALIGNMENT_SHIFT;
 // mremap flag
 pub const MAP_REMAPDUP: ::c_int = 0x004;
 
@@ -1598,6 +1617,10 @@
 pub const LITTLE_ENDIAN: ::c_int = 1234;
 pub const BIG_ENDIAN: ::c_int = 4321;
 
+pub const PL_EVENT_NONE: ::c_int = 0;
+pub const PL_EVENT_SIGNAL: ::c_int = 1;
+pub const PL_EVENT_SUSPENDED: ::c_int = 2;
+
 cfg_if! {
     if #[cfg(any(target_arch = "sparc", target_arch = "sparc64",
                  target_arch = "x86", target_arch = "x86_64"))] {
@@ -1696,6 +1719,13 @@
 
 pub const TMP_MAX: ::c_uint = 308915776;
 
+pub const AI_PASSIVE: ::c_int = 0x00000001;
+pub const AI_CANONNAME: ::c_int = 0x00000002;
+pub const AI_NUMERICHOST: ::c_int = 0x00000004;
+pub const AI_NUMERICSERV: ::c_int = 0x00000008;
+pub const AI_ADDRCONFIG: ::c_int = 0x00000400;
+pub const AI_SRV: ::c_int = 0x00000800;
+
 pub const NI_MAXHOST: ::socklen_t = 1025;
 pub const NI_MAXSERV: ::socklen_t = 32;
 
@@ -1957,6 +1987,14 @@
 pub const PT_GET_PROCESS_STATE: ::c_int = 18;
 pub const PT_FIRSTMACH: ::c_int = 32;
 
+pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01;
+pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02;
+pub const POSIX_SPAWN_SETSCHEDPARAM: ::c_int = 0x04;
+pub const POSIX_SPAWN_SETSCHEDULER: ::c_int = 0x08;
+pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x10;
+pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x20;
+pub const POSIX_SPAWN_RETURNERROR: ::c_int = 0x40;
+
 // Flags for chflags(2)
 pub const SF_SNAPSHOT: ::c_ulong = 0x00200000;
 pub const SF_LOG: ::c_ulong = 0x00400000;
@@ -2507,10 +2545,23 @@
     pub fn emalloc(n: ::size_t) -> *mut ::c_void;
     pub fn ecalloc(n: ::size_t, c: ::size_t) -> *mut ::c_void;
     pub fn erealloc(p: *mut ::c_void, n: ::size_t) -> *mut ::c_void;
+    pub fn ereallocarr(p: *mut ::c_void, n: ::size_t, s: ::size_t);
     pub fn estrdup(s: *const ::c_char) -> *mut ::c_char;
     pub fn estrndup(s: *const ::c_char, len: ::size_t) -> *mut ::c_char;
     pub fn estrlcpy(dst: *mut ::c_char, src: *const ::c_char, len: ::size_t) -> ::size_t;
     pub fn estrlcat(dst: *mut ::c_char, src: *const ::c_char, len: ::size_t) -> ::size_t;
+    pub fn estrtoi(
+        nptr: *const ::c_char,
+        base: ::c_int,
+        lo: ::intmax_t,
+        hi: ::intmax_t,
+    ) -> ::intmax_t;
+    pub fn estrtou(
+        nptr: *const ::c_char,
+        base: ::c_int,
+        lo: ::uintmax_t,
+        hi: ::uintmax_t,
+    ) -> ::uintmax_t;
     pub fn easprintf(string: *mut *mut ::c_char, fmt: *const ::c_char, ...) -> ::c_int;
     pub fn evasprintf(string: *mut *mut ::c_char, fmt: *const ::c_char, ...) -> ::c_int;
     pub fn esetfunc(
@@ -2578,6 +2629,50 @@
         tpe: ::c_int,
     );
 
+    pub fn getxattr(
+        path: *const ::c_char,
+        name: *const ::c_char,
+        value: *mut ::c_void,
+        size: ::size_t,
+    ) -> ::ssize_t;
+    pub fn lgetxattr(
+        path: *const ::c_char,
+        name: *const ::c_char,
+        value: *mut ::c_void,
+        size: ::size_t,
+    ) -> ::ssize_t;
+    pub fn fgetxattr(
+        filedes: ::c_int,
+        name: *const ::c_char,
+        value: *mut ::c_void,
+        size: ::size_t,
+    ) -> ::ssize_t;
+    pub fn setxattr(
+        path: *const ::c_char,
+        name: *const ::c_char,
+        value: *const ::c_void,
+        size: ::size_t,
+    ) -> ::c_int;
+    pub fn lsetxattr(
+        path: *const ::c_char,
+        name: *const ::c_char,
+        value: *const ::c_void,
+        size: ::size_t,
+    ) -> ::c_int;
+    pub fn fsetxattr(
+        filedes: ::c_int,
+        name: *const ::c_char,
+        value: *const ::c_void,
+        size: ::size_t,
+        flags: ::c_int,
+    ) -> ::c_int;
+    pub fn listxattr(path: *const ::c_char, list: *mut ::c_char, size: ::size_t) -> ::ssize_t;
+    pub fn llistxattr(path: *const ::c_char, list: *mut ::c_char, size: ::size_t) -> ::ssize_t;
+    pub fn flistxattr(filedes: ::c_int, list: *mut ::c_char, size: ::size_t) -> ::ssize_t;
+    pub fn removexattr(path: *const ::c_char, name: *const ::c_char) -> ::c_int;
+    pub fn lremovexattr(path: *const ::c_char, name: *const ::c_char) -> ::c_int;
+    pub fn fremovexattr(fd: ::c_int, path: *const ::c_char, name: *const ::c_char) -> ::c_int;
+
     pub fn string_to_flags(
         string_p: *mut *mut ::c_char,
         setp: *mut ::c_ulong,

@grtcdr
Copy link
Member

grtcdr commented Nov 12, 2021

You're right, but I'm not a systems expert, so I couldn't tell you for sure why this might be happening or if the new changes could have an effect on the functions we use.

It's a weird situation, Linux, Android, NetBSD, and macOS all share the same username() method.

@0323pin
Copy link
Author

0323pin commented Nov 12, 2021

Sure, I understand this. I just would like to find it so I could open an issue with libc claiming there's a regresssion. As the issue was already present in v0.2.106 and v0.2.104 worked fine.

@grtcdr
Copy link
Member

grtcdr commented Nov 12, 2021

Hmm, before filing an issue, I'll create a branch with libc downgraded to the latest known working version, and tell me if host/shell work.

@0323pin
Copy link
Author

0323pin commented Nov 12, 2021

@grtcdr I had the same thought and was about to ask you for that but, didn't dare :)

Let me know when it's there and I'll build it straight away. Thanks!

@grtcdr
Copy link
Member

grtcdr commented Nov 12, 2021

Alrighty, the branch is ready, it's called downgrade-libc.

@0323pin
Copy link
Author

0323pin commented Nov 12, 2021

Awesome, give me 30 min.

@grtcdr
Copy link
Member

grtcdr commented Nov 12, 2021

Take your time, just know that I have no issues sticking with 0.2.104 for a while if it turns out to be a libc issue.

@0323pin
Copy link
Author

0323pin commented Nov 12, 2021

I don't see it downgraded in libmacchina, though.

@grtcdr
Copy link
Member

grtcdr commented Nov 12, 2021

libmacchina also has a branch called downgrade-libc.

@0323pin
Copy link
Author

0323pin commented Nov 12, 2021

atty pulls-in libc-0.2.107 also but, it's building now. Back to you soon, thanks.

@0323pin
Copy link
Author

0323pin commented Nov 12, 2021

Hmm... got a warning but, it compiled just fine.

   Compiling libmacchina v3.8.5 (/usr/pkgsrc/wip/macchina/work/macchina-0086f69be68dfdbf7366e86544777b02147438a5/libmacchina-5e519c4c608b9d5e0b62a4faeaea95757720f17f)
   Compiling macchina v5.0.5 (/usr/pkgsrc/wip/macchina/work/macchina-0086f69be68dfdbf7366e86544777b02147438a5)
warning: unused import: `std::path::PathBuf`
 --> libmacchina-5e519c4c608b9d5e0b62a4faeaea95757720f17f/src/winman.rs:7:5
  |
7 | use std::path::PathBuf;
  |     ^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: `libmacchina` (lib) generated 1 warning

Although, the issue doesn't seem to be with libc.

/home/pin()
2021-11-12 14:23 > macchina -v
macchina    5.0.5
libmacchina 3.8.5
/home/pin()
2021-11-12 14:25 > macchina -d
Let's check your system for errors... Here's a summary:

We've collected 11 readouts, including 2 failed read(s) and 0 read(s) which resulted in a warning.
Readout "Host" failed with message: Unable to read account information.
Readout "Shell" failed with message: Unable to read account information.
/home/pin()
2021-11-12 14:25 > 

And if I install macchina-5.0.3 again it's fine, wtf?

@grtcdr
Copy link
Member

grtcdr commented Nov 12, 2021

Hmm... got a warning

I'll fix that right up.

wtf

Absolutely, I have no idea what's going on at this point...

EDIT: I do know what's wrong, it's me.

Let's observer one of the conditions of get_password_struct:

  • Previous versions:
if passwd != std::ptr::null_mut() {
// do something
}
  • Newer versions:
if passwd.is_null() {
// do something
}

I was basically trying to satisfy clippy, but forgot to prepend a ! before the condition.

@0323pin
Copy link
Author

0323pin commented Nov 12, 2021

I just had to try going back to v5.0.3 and here,

2021-11-12 15:04 > macchina -v
macchina    5.0.3
libmacchina 3.4.3
/home/pin()
2021-11-12 15:04 > macchina
                                                                
  Host         pin@mybox                                        
  Machine      Hewlett-Packard HP EliteBook 820 G1 A3009DD10303
  OS           NetBSD 9.99.92                                   
  WM           Franken                                          
  Packages     211 (pkgsrc)                                     
  Terminal     xterm                                            
  Shell        nu                                               
  Uptime       8h 36m                                           
  CPU          Intel® Core™ i5-4210U CPU @ 1.70GHz (4)          
  Memory       2.1 GB/7.5 GB                                    
  Battery      91% & Discharging                                
                                                                
                                                                

/home/pin()
2021-11-12 15:04 > macchina -d
Let's check your system for errors... Here's a summary:

We've collected 11 readouts, including 0 failed read(s) and 0 read(s) which resulted in a warning.
🎉 You are good to go! No failures detected.
/home/pin()
2021-11-12 15:04 > 

Just so you know, I'm not just assuming.

@grtcdr
Copy link
Member

grtcdr commented Nov 12, 2021

Read my edit, it turned out to be me that made a big, gigantic, huge mistake.

@grtcdr
Copy link
Member

grtcdr commented Nov 12, 2021

I have the same errors as you, my apologies for this gigantic fuck-up on my part.

@grtcdr
Copy link
Member

grtcdr commented Nov 12, 2021

I've published the fix, and will release a new version right away.

@0323pin
Copy link
Author

0323pin commented Nov 12, 2021

@grtcdr No worries, I'm happy we have reached the bottom of this.

@grtcdr
Copy link
Member

grtcdr commented Nov 12, 2021

Thank you 😄

@0323pin
Copy link
Author

0323pin commented Nov 12, 2021

Closing this now! Thanks!

@0323pin 0323pin closed this as completed Nov 12, 2021
@0323pin
Copy link
Author

0323pin commented Nov 12, 2021

I'll build and merge the new version as soon as possible but, my time for today is out.

@grtcdr
Copy link
Member

grtcdr commented Nov 12, 2021

No problem ✌️

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

No branches or pull requests

2 participants