Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deleting/ modifying file contents from phpstorm changes group of the file in Linux (Ubuntu)

I am logged in as "user" in Ubuntu 12.04 In my "project" directory i have created a file query.sql. This file has permission like below.

-rw-rw-r-- 1 user user  946 Dec  2 17:51 query.sql

This file should be web writable. So i ran this command.

sudo chown :www-data query.sql

Now the permission is

-rw-rw-r-- 1 user www-data  946 Dec  2 17:51 query.sql

If i modify content of query.sql from phpstorm, group is set again as user. Like:

-rw-rw-r-- 1 user user  937 Dec  2 17:57 query.sql

If i modify query.sql content using other editor like gedit this problem do not happen.

IDE Version: 8.0.1 Build: 138.2001

like image 974
chanchal118 Avatar asked Feb 11 '23 10:02

chanchal118


1 Answers

Find and disable Use "safe write" option:

  1. Settings (Preferences on Mac)
  2. Using search box (top left corner) search for safe

With this option enabled (by default) the new temp file is created first and then renamed to the correct name -- this will cause the behaviour you have descried (as technically it will be brand new file at the end). When disabled, file will be rewritten in place so no changes to permissions/ownership.

P.S. PhpStorm v8.0.2 (builds on 139.xxx branch) has restructured settings screen. The full path to that option is now Settings | Appearance & Behaviour | System Settings --> Use "safe write"

like image 160
LazyOne Avatar answered Feb 14 '23 00:02

LazyOne