Closed RandalSchwartz closed 1 year ago
This is not making any sense as I've just checked the code. It's happening in exactly the same spot where I now have a null check.
final userInfo = pwPasswd.ref.gecos != null
? copyCBuffToDartString(pwPasswd.ref.gecos!, free: false)
: '';
give me 24hrs to dig into it, and I will try not to click the 'close with comment' button this time.
sorry, didn't intend to close it.
I'm in the middle of a renovation so my mac is packed away. Let me find the box its in so I can test on a mac.
I'm still a little surprised that this didn't fix it as the stack trace is pretty clear unless this
On Thu, Oct 20, 2022 at 3:14 PM Randal L. Schwartz @.***> wrote:
PLEASE STOP CLOSING THE BUG UNTIL I VERIFY.
Because it's still broken, and I have to start a whole new bug report each time.
Activated dcli 1.35.2.
Locohost.local:~ % dcli_install
Please Run:
sudo -E dcli install
Locohost.local:~ % sudo -E dcli_install
Woah! You appear to be trying to run flutter as root.
We strongly recommend running the flutter tool without superuser privileges.
/
📎
UnsupportedError: Unsupported operation: Operation 'toDartString' not allowed on a 'nullptr'.
Stacktrace: utf8.dart : Utf8Pointer._ensureNotNullptr : 62
utf8.dart : Utf8Pointer.toDartString : 42
conversions.dart : copyCBuffToDartString : 53
pwd.dart : _buildPasswd : 288
pwd.dart : getpwnam : 134
simplified.dart : getPassword : 27
posix_shell.dart : PosixShell._resetUserEnvironment : 149
posix_shell.dart : PosixShell.releasePrivileges : 126
install.dart : InstallCommand.run : 90
command_line_runner.dart : CommandLineRunner.process : 98
entry_point.dart : EntryPoint._parseCmdLine : 41
entry_point.dart : EntryPoint.process : 36
dcli_install.dart : DCliInstall.run : 25
dcli_install.dart : main : 11
isolate_patch.dart : _delayEntrypointInvocation.
: 295 isolate_patch.dart : _RawReceivePortImpl._handleMessage : 192
Locohost.local:~ %
— Reply to this email directly, view it on GitHub https://github.com/onepub-dev/dcli/issues/204, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG32OHVO6F34AVSF2LCI2LWEDBJFANCNFSM6AAAAAARJXLJRA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
I think I understand the problem, gcos is a ffi pointer so I need to open the pointer to check if it's null.
will try to get a fix out over the weekend.
On Thu, Oct 20, 2022 at 4:18 PM Brett Sutton @.***> wrote:
sorry, didn't intend to close it.
I'm in the middle of a renovation so my mac is packed away. Let me find the box its in so I can test on a mac.
I'm still a little surprised that this didn't fix it as the stack trace is pretty clear unless this
On Thu, Oct 20, 2022 at 3:14 PM Randal L. Schwartz < @.***> wrote:
PLEASE STOP CLOSING THE BUG UNTIL I VERIFY.
Because it's still broken, and I have to start a whole new bug report each time.
Activated dcli 1.35.2.
Locohost.local:~ % dcli_install
Please Run:
sudo -E dcli install
Locohost.local:~ % sudo -E dcli_install
Woah! You appear to be trying to run flutter as root.
We strongly recommend running the flutter tool without superuser privileges.
/
📎
UnsupportedError: Unsupported operation: Operation 'toDartString' not allowed on a 'nullptr'.
Stacktrace: utf8.dart : Utf8Pointer._ensureNotNullptr : 62
utf8.dart : Utf8Pointer.toDartString : 42
conversions.dart : copyCBuffToDartString : 53
pwd.dart : _buildPasswd : 288
pwd.dart : getpwnam : 134
simplified.dart : getPassword : 27
posix_shell.dart : PosixShell._resetUserEnvironment : 149
posix_shell.dart : PosixShell.releasePrivileges : 126
install.dart : InstallCommand.run : 90
command_line_runner.dart : CommandLineRunner.process : 98
entry_point.dart : EntryPoint._parseCmdLine : 41
entry_point.dart : EntryPoint.process : 36
dcli_install.dart : DCliInstall.run : 25
dcli_install.dart : main : 11
isolate_patch.dart : _delayEntrypointInvocation.
: 295 isolate_patch.dart : _RawReceivePortImpl._handleMessage : 192
Locohost.local:~ %
— Reply to this email directly, view it on GitHub https://github.com/onepub-dev/dcli/issues/204, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG32OHVO6F34AVSF2LCI2LWEDBJFANCNFSM6AAAAAARJXLJRA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
So I've managed to reproduce the problem on my mac and now have a fix. If all goes well should have a release today.
1.35.3
turned out to be 1.35.4 after a failed release.
Give it a try and let me know how it goes.
At least it's a different kind of fail:
Activated dcli 1.35.4.
Locohost.local:~ % dcli_install
Please Run:
sudo -E dcli install
Locohost.local:~ % sudo -E dcli_install
Woah! You appear to be trying to run flutter as root.
We strongly recommend running the flutter tool without superuser privileges.
/
📎
Hang on a tick whilst we install DCli 1.35.4
You must first install dart.
See the install instructions at: https://dart.dev/get-dart
Woah! You appear to be trying to run flutter as root.
We strongly recommend running the flutter tool without superuser privileges.
/
📎
Creation failed, path = '/.pub-cache' (OS Error: Read-only file system, errno = 30)
RunException: /Users/merlyn/fvm/default/bin/dart pub global activate dcli
exit: 66
reason: The command [/Users/merlyn/fvm/default/bin/dart] with args [pub, global, activate, dcli] failed with exitCode: 66 workingDirectory: /Users/merlyn
Stacktrace: wait_for_ex.dart : waitForEx : 27
runnable_process.dart : RunnableProcess.processUntilExit : 479
runnable_process.dart : RunnableProcess.run : 188
run.dart : startFromArgs : 180
dart_sdk.dart : DartSdk.runPub : 244
pub_cache.dart : PubCache.globalActivate : 212
mac_os_installer.dart : MacOSDCliInstaller.install : 32
posix_shell.dart : PosixShell.install : 192
install.dart : InstallCommand.run : 112
command_line_runner.dart : CommandLineRunner.process : 98
entry_point.dart : EntryPoint._parseCmdLine : 41
entry_point.dart : EntryPoint.process : 36
dcli_install.dart : DCliInstall.run : 25
dcli_install.dart : main : 11
isolate_patch.dart : _delayEntrypointInvocation.<anonymous closure> : 295
isolate_patch.dart : _RawReceivePortImpl._handleMessage : 192
Locohost.local:~ %
sigh, so I'm going to have to get my mac test environment back up and running. I was hoping I could get away with a little patch...
It looks like the pub command isn't getting the correct HOME path after I release the sudo privileges. I will dig in and let you know when I have a fix.
So beginning to understand the issue.
The latest flutter command checks for the EUID environment var to see if we are running as root.
The odd thing is that zsh has the var but it's not passed to platform.environment.
So I'm wondering if EUID is some type of virtual environment variable?
So I think the issue is that the call I make to seteuid isn't working as expected.
So I think this is the problem:
If the shell is started with the effective user (group) id not equal to the real user (group) id, and the -p option is not supplied, no startup files are read, shell functions are not inherited from the environment, the SHELLOPTS, BASHOPTS, CDPATH, and GLOBIGNORE variables, if they appear in the environment, are ignored, and the effective user id is set to the real user id. If the -p option is supplied at invocation, the startup behavior is the same, but the effective user id is not reset.
because dart doesn't like to be run as sudo I call seteuid with the logged in users uid. The problem is that dart/flutter is a script and they have recently started checking EUID. So it looks like I need to pass the -p option when starting dart/flutter.
I still don't understand why dcli_install needs any privs above my user's privs anyway. Can you explain that further? Everything it would want to change of my user is editable by... my user.
Just an updated. I've found the source of the problem. zsh reverts the euid back to the ruid.
I have a solution for this but need to find some time to test it.
As to the sudo. I would have to be back through the code, but it does make some changes that require it. I've tried to remove the need for sudo on a couple of occasions but it with no luck. So I just need to get the release privileges logic to work correctly, which I think I now have.
Where are you installing something that my user doesn't have access?
Looking at the installer the core reason is that we are adding dcli exe to the sudo path so that you can still run dcli from sudo. This is a bit of a work in progress as running dart under sudo is tricky.
Looking at the installer the core reason is that we are adding dcli exe to the sudo path so that you can still run dcli from sudo. This is a bit of a work in progress as running dart under sudo is tricky.
This should be only on demand. It should install fine without sudo for 99% of the users out there.
I've released dcli 2.0.0-beta.13 This installs on my mac. Can you take it for a spin and let me know how it goes.
The first concern with an 'on-demand' approach is, how do people discover it's an option?
If the installer works correctly is the 'sudo' requirement that onerous?
On Sat, Oct 29, 2022 at 5:56 PM Randal L. Schwartz @.***> wrote:
Looking at the installer the core reason is that we are adding dcli exe to the sudo path so that you can still run dcli from sudo. This is a bit of a work in progress as running dart under sudo is tricky.
This should be only on demand. It should install fine without sudo for 99% of the users out there.
— Reply to this email directly, view it on GitHub https://github.com/onepub-dev/dcli/issues/204#issuecomment-1295753865, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG32OFJT6JXEKAPD6L3T6TWFTDCPANCNFSM6AAAAAARJXLJRA . You are receiving this because you commented.Message ID: @.***>
FYI: there is an option to install without privileges
dcli install --noprivileges
On Sat, Oct 29, 2022 at 9:32 PM Brett Sutton @.***> wrote:
The first concern with an 'on-demand' approach is, how do people discover it's an option?
If the installer works correctly is the 'sudo' requirement that onerous?
On Sat, Oct 29, 2022 at 5:56 PM Randal L. Schwartz < @.***> wrote:
Looking at the installer the core reason is that we are adding dcli exe to the sudo path so that you can still run dcli from sudo. This is a bit of a work in progress as running dart under sudo is tricky.
This should be only on demand. It should install fine without sudo for 99% of the users out there.
— Reply to this email directly, view it on GitHub https://github.com/onepub-dev/dcli/issues/204#issuecomment-1295753865, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG32OFJT6JXEKAPD6L3T6TWFTDCPANCNFSM6AAAAAARJXLJRA . You are receiving this because you commented.Message ID: @.***>
dcli install --noprivileges
That should be part of the "please use sudo" message then.
And, it still fails for 1.35.4:
Hang on a tick whilst we install DCli 1.35.4
You must first install dart.
See the install instructions at: https://dart.dev/get-dart
Woah! You appear to be trying to run flutter as root.
We strongly recommend running the flutter tool without superuser privileges.
/
📎
Creation failed, path = '/.pub-cache' (OS Error: Read-only file system, errno = 30)
RunException: /Users/merlyn/fvm/default/bin/dart pub global activate dcli
exit: 66
reason: The command [/Users/merlyn/fvm/default/bin/dart] with args [pub, global, activate, dcli] failed with exitCode: 66 workingDirectory: /Users/merlyn/Play/Dart/MIRROR
Stacktrace: wait_for_ex.dart : waitForEx : 27
runnable_process.dart : RunnableProcess.processUntilExit : 479
runnable_process.dart : RunnableProcess.run : 188
run.dart : startFromArgs : 180
dart_sdk.dart : DartSdk.runPub : 244
pub_cache.dart : PubCache.globalActivate : 212
mac_os_installer.dart : MacOSDCliInstaller.install : 32
posix_shell.dart : PosixShell.install : 192
install.dart : InstallCommand.run : 112
command_line_runner.dart : CommandLineRunner.process : 98
entry_point.dart : EntryPoint._parseCmdLine : 41
entry_point.dart : EntryPoint.process : 36
dcli_install.dart : DCliInstall.run : 25
dcli_install.dart : main : 11
isolate_patch.dart : _delayEntrypointInvocation.<anonymous closure> : 295
isolate_patch.dart : _RawReceivePortImpl._handleMessage : 192
I've not updated 1.35.X only the 2.x branch.
If the 2.x branch fixes the problem I will either release 2.x or back port to 1.35.
2.0 seems to have worked, but regressed on the sudo -E message back to the older form.
2.0 seems to have worked, but regressed on the sudo -E message back to the older form.
I regressed the message to the older form as on linux it wasn't working in all scenarios and I couldn't work out why.
The PATH wasn't being passed down.
On Wed, Nov 2, 2022 at 3:50 AM Randal L. Schwartz @.***> wrote:
2.0 seems to have worked, but regressed on the sudo -E message back to the older form.
— Reply to this email directly, view it on GitHub https://github.com/onepub-dev/dcli/issues/204#issuecomment-1298823933, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG32ODKK2YTEBN7V7A4XFTWGFC7FANCNFSM6AAAAAARJXLJRA . You are receiving this because you commented.Message ID: @.***>
I've just back ported this fix to 1.35.6
I believe this is fixed so will close out.
PLEASE STOP CLOSING THE BUG UNTIL I VERIFY.
Because it's still broken, and I have to start a whole new bug report each time.