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
mosh doesn't work on PowerPC OS X 10.5 (Leopard) #479
Comments
If you apply #452 on the client side, you might get a more informative error message. |
Also, this might be related to #424? (I’m not a Mac user.) |
I'll happily try it - it may take me a day or two. |
I manually applied #452 to 1.2.4 as downloaded by Tigerbrew using 'brew install --interactive'. There's still no useful error output after switching to alternate screen and back; it just does that and prints "[mosh is exiting.]" after a couple line feeds as before. |
What can I do to help get this working on PowerPC? Now that I'm used to mosh, its lack is very limiting on my PPC laptop. |
What happens when you run mosh-server and mosh-client separately (as described at http://mosh.mit.edu)? |
Okay, I've installed mosh again on my G4 with Tigerbrew (see mistydemeo/tigerbrew#87 for related ticket). This installs 1.2.4, downloading the tarball straight from mosh.mit.edu. This is on OS X 10.5.8 running on a PPC 7450 (1.25GHz G4). Compilation was mostly accomplished with 'cc1plus' - just watched 'top' as it was building. Here's the build output, if it's useful:
So, I run mosh-server on the remote host:
And then I run mosh-client on the G4, and it exits in probably less than half a second with an interesting message at thte top-of-screen bar, more on that in a sec, but here's how I executed it (IP redacted):
First order of business: I'm connecting from my home here with the G4. All other machines using mosh - OS X Intel, Linux, and Linux on Raspberry Pi - have never had any problems connecting to this remote host through my NAT, and have been doing so for months, multiple times a day. This problem also occurs on the G4 on friends' networks, coffee shops, and so on, so I'm fairly confident that it's not a networking problem external to the G4. I've also never observed these symptoms on anything but the G4. Now to the more interesting bits. First, when I attempted to connect with 'mosh-client' and it rapidly exited, I noticed a flash of the top-of-screen bar, so I ran it multiple times so that I'd have enough time to read it. The bar read something as follows, but with the "without contact" time randomized between about 20:00 and 55:00 every execution.
Finally, when I looked for PID 3546 on the remote host, it did not exist. I hope this is useful! Let me know if there are more steps I can take. |
Building with GCC 4.8 (built from Tigerbrew) does not solve this problem on PPC 7450 ("G4e") running 10.5.8. |
This is broken the same way on OS X 10.5.8 on a G5 (PPC 970), so it's not just confined to PPC 7450. |
I can repro on a PowerBook G4 with OS X 10.5.8. I'll try building on Intel OS X 10.5.8 to see if it occurs there as well. |
I tested on an Intel Leopard machine, and a command that fails on PowerPC succeeds there. I suspect there may be an endianness issue here. |
So it turns out this is a simple endian issue, in the timestamp code - thanks to @keithw for suggesting it was the timestamp. The timestamp code has a Darwin-specific code path that uses
millis_cache = ((mach_absolute_time() * s_timebase_info.numer) / (1000000 * s_timebase_info.denom)); The division with a different integer type produces a wrong result on PowerPC, which is big-endian, and that's the cause of the hugely wrong timestamps @gordon-morehouse was seeing. Creating a uint64_t 1000000 and dividing by that produces correct results. That said, it seems unnecessary to have Darwin-specific timestamp code given that |
freeze_timestamp() was previously using the mach_absolute_time() function on Darwin to determine time. This isn't really necessary, since Darwin also supports gettimeofday(). (mach_absolute_time() also introduced a minor endian bug that caused implausible timestamps on PowerPC, which is easily fixed but doesn't happen with gettimeofday() anyway.) Fixes mobile-shell#479.
Multiplying a uint64_t by an int was producing wrong results on big- endian architectures (e.g. PowerPC). This resulted in implausible timestamps that caused mosh to exit instantly on starting up. Fixes mobile-shell#479.
When converting the value of mach_absolute_time() into milliseconds, multiplying a uint64_t by an int was producing wrong results on big- endian architectures (e.g. PowerPC) due to the larger value of s_timebase_info.denom on that platform. This resulted in implausible timestamps that caused mosh to exit instantly on starting up. Fixes mobile-shell#479.
A Darwin PPC 32-bit user observes huge values numer == 1000000000 and denom == 18431683 returned from mach_timebase_info(). For these values, mach_absolute_time() * numer overflows uint64_t every 1000.82 seconds, and 1000000 * denom always overflows uint32_t, with the effect of making time run backwards at -11190660 times its usual speed. This bug was masked on Darwin x86 64-bit, where numer == denom == 1. Fix it by doing the conversion with double arithmetic instead. Closes mobile-shell#479. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
A Darwin PPC 32-bit user observes huge values numer == 1000000000 and denom == 18431683 returned from mach_timebase_info(). For these values, mach_absolute_time() * numer overflows uint64_t every 1000.82 seconds, and 1000000 * denom always overflows uint32_t, with the effect of making time run backwards at -11190660 times its usual speed. This bug was masked on Darwin x86 64-bit, where numer == denom == 1. Fix it by doing the conversion with double arithmetic instead. Closes mobile-shell#479. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Built 1.2.4 from source after trying Tigerbrew's 1.2.4. Both seem to connect and then instantly exit, saying
After a couple of line feeds. Tried on a couple different mosh servers, x86 and ARM, both Debian or close enough.
The text was updated successfully, but these errors were encountered: