atom / atom

:atom: The hackable text editor
https://atom.io
MIT License
60.24k stars 17.39k forks source link

Saving a write protected file freezes Atom #9360

Closed michaeljdennis closed 9 years ago

michaeljdennis commented 9 years ago

OS X: 10.11.1 Atom: 1.1.0

Saving a write protected file, in this case a config file located in /etc, freezes Atom. The menu bar is still usable though. I can select Atom > Quit and after a few seconds I get an "Editor is not responding" dialog box.

Saving these files did not freeze Atom prior to today's 1.1.0 release but it did make the cursor disappear as reported in #9340.

maxbrunsfeld commented 9 years ago

I can reproduce this on master.

  1. sudo touch a-file.txt
  2. atom a-file.txt
  3. save

It looks like we're blocked reading from a pipe in the runas module.

frame #4: 0x00007fff81cd59f0 libsystem_c.dylib`fread + 48
frame #5: 0x00000001128d2fb9 runas.node`runas::Runas(command=<unavailable>, args=<unavailable>, std_input=<unavailable>, std_output="", std_error=<unavailable>, options=<unavailable>, exit_code=<unavailable>) + 297 at runas_darwin.cc:80
frame #6: 0x00000001128d24e5 runas.node`(anonymous namespace)::Runas(info=0x00007fff56931948) + 1151 at main.cc:48
frame #7: 0x00000001128d29b6 runas.node`Nan::imp::FunctionCallbackWrapper(info=0x00007fff56931988) + 131 at nan_callbacks_12_inl.h:174

/cc @zcbenz

zcbenz commented 9 years ago

It seems that reading stdout from the stream returned by ExecuteWithPrivileges will block forever if there is no output, this behavior seems to be undocumented, and the only usage of ExecuteWithPrivileges with fread I can find on web is the runas module itself.

zcbenz commented 9 years ago

Fixed with https://github.com/atom/node-runas/commit/0614756bf909d1161f445af45d3a8efc33a8aa48.

maxbrunsfeld commented 9 years ago

Thanks @zcbenz!

benogle commented 9 years ago

:clap:

michaeljdennis commented 9 years ago

:+1:

lock[bot] commented 5 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!