lukepistrol / TimeMachineStatus

TimeMachineStatus is a little menu bar application for macOS which aims to show more useful information than the system default.
Other
256 stars 2 forks source link

🐞: [BUG] Expected to decode Bool #17

Closed iclems closed 6 months ago

iclems commented 10 months ago

Describe the bug Probably related to Time Machine Editor.

To Reproduce Steps to reproduce the behavior:

  1. Go to app
  2. Shows 100% of the time

Expected behavior Only shows an error when opening

Screenshots

image

Additional context Add any other context about the problem here.

iclems commented 10 months ago

Sorry for filing this, bought you a coffee to apologise for the noise :-) I can probably take a look at the code in a couple of weeks myself to debug if you need help

lukepistrol commented 10 months ago

Thx for submitting the bug and for the coffee of course!

Looks like the RequiresACPower value in /Library/Preferences/com.apple.TimeMachine.plist is neither 0 nor 1 in your case. Could you please share what value it is in your case?

Maybe I need to change this to an enum of some sort instead of a boolean.

It would be interesting to know what possible values there could be.

iclems commented 10 months ago

For some weird reason it’s a string here: 

On 9 Jan 2024, at 12:07, Lukas Pistrol @.***> wrote:

Thx for submitting the bug and for the coffee of course!

Looks like the RequiresACPower value in /Library/Preferences/com.apple.TimeMachine.plist is neither 0 nor 1 in your case. Could you please share what value it is in your case?

Maybe I need to change this https://github.com/lukepistrol/TimeMachineStatus/blob/b14769d534db6f8fca08a0a496baf5c3f2dca7ad/TimeMachineStatus/Model/Preferences/Preferences.swift#L32C18-L32C18 to an enum of some sort instead of a boolean.

It would be interesting to know what possible values there could be.

— Reply to this email directly, view it on GitHub https://github.com/lukepistrol/TimeMachineStatus/issues/17#issuecomment-1882869800, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIROMVJXXWK2JLRFZHTWW3YNUQIFAVCNFSM6AAAAABBS4MMDKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBSHA3DSOBQGA. You are receiving this because you authored the thread.

lukepistrol commented 10 months ago

And what string? Which device are you on? Any special energy related settings?

I tried on both my Mac Mini and (Intel) MacBook Pro and couldn't reproduce it unfortunately. The checkbox in Time Machine Settings for backing up on battery power only changes the value to either 0 or 1. And energy related settings like Power Nap have no impact on the value.

iclems commented 10 months ago

It’s actually a 0 (I attached a screenshot earlier) but set as a string. Maybe a tool I used tricked it… unfortunately it’s hard to unlock this file to edit manually

Clément

Le mar. 9 janv. 2024 à 12:29, Lukas Pistrol @.***> a écrit :

And what string? Which device are you on? Any special energy related settings?

I tried on both my Mac Mini and (Intel) MacBook Pro and couldn't reproduce it unfortunately. The checkbox in Time Machine Settings for backing up on battery power only changes the value to either 0 or 1. And energy related settings like Power Nap have no impact on the value.

— Reply to this email directly, view it on GitHub https://github.com/lukepistrol/TimeMachineStatus/issues/17#issuecomment-1882900403, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIROMV2HFEV5VXMSKKTC63YNUSZZAVCNFSM6AAAAABBS4MMDKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBSHEYDANBQGM . You are receiving this because you authored the thread.Message ID: @.***>

lukepistrol commented 10 months ago

This file should not be edited manually. Which tool are you talking about?

Could you run the following command in a terminal session to read the file out?

plutil -p /Library/Preferences/com.apple.TimeMachine.plist

Then look for the line that starts with "RequiresACPower" =>. What value has it assigned? It should be either 0 or 1 (without any quotes) like so:

  "RequiresACPower" => 1
iclems commented 10 months ago

"RequiresACPower" => "0"

The problem is that it’s “0” and not just 0 so it’s a string with a 0 inside, not a bool in my case

On 18 Jan 2024, at 13:58, Lukas Pistrol @.***> wrote:

This file should not be edited manually. Which tool are you talking about?

Could you run the following command in a terminal session to read the file out?

plutil -p /Library/Preferences/com.apple.TimeMachine.plist Then look for the line that starts with "RequiresACPower" =>. What value has it assigned? It should be either 0 or 1 (without any quotes) like so:

"RequiresACPower" => 1 — Reply to this email directly, view it on GitHub https://github.com/lukepistrol/TimeMachineStatus/issues/17#issuecomment-1898433527, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIROMRAFQ4CQTN6F77JVWLYPEL63AVCNFSM6AAAAABBS4MMDKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJYGQZTGNJSG4. You are receiving this because you authored the thread.

lukepistrol commented 10 months ago

Ok then something messed up your time machine preferences.

To fix this you can simply run this in Terminal:

sudo defaults write /Library/Preferences/com.apple.TimeMachine.plist RequiresACPower -bool NO