How to control file permissions in CVS repository? - permissions

Currently some users have their umask set in ways which result in execute permission on regular files, which I'd like to avoid.
Is there a way to force all files checked in to only be read with some exceptions?
What is the recommended way to handle this in CVS?

Cvs command option watch is also preventing file permissions to be restored. If watched, when file is checked out it will be read-only. From cvs man pages:
$ cvs watch --help_options
Usage: cvs watch {on|off|add|remove} [-lR] [-a <action>]... [<path>]...
on/off: turn on/off read-only checkouts of files
So, use cvs watch off filename to remove checkout from repository making it read only every time.

I am not sure if this is the best solution, but I would probably do something with the cvswrappers file in CVSROOT directory of the repo, using commitinfo, commitcheck and commit_prep.pl. If you don't have commit_prep.pl, you can use something like this one:
http://opensource.apple.com/source/cvs/cvs-29/cvs/contrib/commit_prep.pl
There are quite a few examples on the web, so just search for those commit* files if you don't already have those in your repo.
Note that, as this post suggests, the permission is really set only during the first commit of a file, after that, you'd need to "manually" modify the permission on the repository itself.
How do I add execute permission to a file in CVS after it's already been checked in?
In commit_prep.pl, you can clear the exec permission using chmod ugo-x , before the file is committed for the first time.
This solution assumes you are using linux.

Related

Is it possible to auto allow usage of the microphone in chromium

I man using chromium-browser on raspbian. I was wondering if there was an easy way to auto allow the usage of the microphone. To stop the pop-up blocking one can use the switch --disable-popup-blocking. Sadly I haven't found a switch on here. This list may be incomplete, so maybe I'm missing the switch I need.
To give more context: my home directory is on tmpfs. This means my preferences file is gone after every reboot. But it should be possible to just copy an old Preferences file into the ~/.config/chromium/Default/ directory right? I tried this already, then started the chromium-browser, but when accessing the site I was asked again if I would allow access to the microphone. It seems like the Preferences file just get overwritten on startup, it doesn't matter that it already exists.
I also tried starting chromium-browser so that it creates all the files including the Preferences file and replacing the media_stream_mic entry. But my guess would be that the preferences only get loaded on start so this does nothing.
So am I doing anything wrong? Or is there an easier way to do what I want?
It seems like the problem was the missing ~/.config/chromium/First Run file. If it doesn't exist the chromium-browser will create all the files anew, including the Preferences file which then gets overwritten. If it does exist only the missing files will be created. So copying a version of your Preferences File into ~/.config/chromium/Default/Preferences and creating a the ~/.config/chromium/First Run file will make this possible.
The bash script to do this automatically could look something like this:
mkdir /home/user/.config/chromium
mkdir /home/user/.config/chromium/Default
cp /somewhere/myOldPrefs /home/user/.config/chromium/Default/Preferences
touch /home/user/.config/chromium/First\ Run
chown -R user:user /home/user/.config/chromium
To insert more mic allowed pages one could use a simple sed command, it could look something like this:
sed -i 's/"media_stream_mic":{}/"media_stream_mic":{"https:\/\/\some\.page\.com:443,\*": {"expiration": "0","last_modified": "13271235276310223","model": 0,"setting": 1}}/' /path/to/the/Preferences
# this adds only one page when there are no pages yet

Create repository in non-empty remote folder

It's been 14 years since I last worked with svn and appearently I have forgotten everything...
I have an existing web-project, consisting of a bunch of php, html, js and other files in a directory tree on a V-Server. Now I want to take these folders under version control and create a copy on my local machine using svn. So I installed subversion according to these instructions: https://www.linuxcloudvps.com/blog/how-to-install-svn-server-on-debian-9/
Using the already-present apache2.
But now I kinda hit a roadblock. If I try svnadmin create on the existing folder, it tells me that is is not empty and does nothing really. All the questions and answers I find here and elsewhere are either
a) focussing on an already existing folder on the local machine
b) assuming more prior knowledge than I have right now aka I don't understand them.
Is there a step-by-step guide for dummies anywhere on how to do this? Or can anyone tell me in laymans terms how to do this?
I can't believe this case never comes up or that it is really very complicated.
At the risk of failing to understand your exact needs, I think you can proceed as follows. I'll use this terms:
Code: it's the unversioned directory at V-Server where you currently have the bunch of php, html, js and other files
Repository: it's the first "special" directory you need to create in order to store your Subversion history and potentially share it with others. There must be one and there can only be one.
Working copy: it's the second "special" directory you need to create in order to work with your php, html, js... files once they are versioned and it'll be linked to a given path and revision of your repository. At a given time there can be zero, one or many of them.
Your code can become a working copy or not, that's up to you, but it can never become a repository:
$ svnadmin create /path/to/code
svnadmin: E200011: Repository creation failed
svnadmin: E200011: Could not create top-level directory
svnadmin: E200011: '/path/to/code' exists and is non-empty
Your repository requires an empty folder but it can be located anywhere you like, as long as you have access to it from the machine you're going to use in your daily work. Access means it's located in your PC (thus you use the file: protocol) or it's reachable through a server you've installed and configured (svn:, http: or https:).
$ svnadmin create /path/to/repo
$ 😎
Your working copies can be created wherever you need to work with your IDE. It can be an empty directory (the usual scenario) or a non-empty one. The checkout command retrieves your files from the repo and puts them in the working copy so, at a later stage, you're able to run a commit command to submit your new and changed files to the repository. As you can figure out it isn't a good idea to create a working copy in random directories because incoming files will mix with existing files. There's however a special situation when it can make sense: when the repository location is new and is still empty. In that case you can choose between two approaches:
If you want code to become a working copy, you can check out right into in and then make an initial commit to upload all files:
$ svn checkout file://path/to/repo /path/to/code
Checked out revision 0.
$ svn add /path/to/code --force
A code/index.php
$ svn commit /path/to/code -m "Import existing codebase"
$ Adding /path/to/code/index.php
$ Transmitting file data .done
$ Committing transaction...
$ Committed revision 1.
If you don't care about code once it's stored in the repository or you want your working copy elsewhere, you can import your files from code and create a working copy in a fresh directory:
$ svn import /path/to/code file://path/to/repo -m "Import existing codebase"
Adding code/index.php
Committing transaction...
Committed revision 1.
$ svn checkout file://path/to/repo fresh
A fresh/index.php
Checked out revision 1.

___jb_bak___ and ___jb_old___ files in PyCharm

When I got some PyCharm project from my colleague I saw some backup files of *.py files.
This files have types: *.___jb_old___ and *.___jb_bak___.
I open the files in Notepad++ and see that these are identical backup files of the corresponding *.py files.
I asked my colleague, but he didn't know what these are.
Why are there TWO identical backup files for each *.py file?
How can I tune PyCharm? We want to turn off this backup.
Google gave me nothing :(
You can disable "safe write"
Use "safe write" (save changes to a temporary file first) If this
check box is selected, a changed file will be first saved to a
temporary file; if the save operation is completed successfully, the
original file is deleted, and the temporary file is renamed.
https://www.jetbrains.com/webstorm/help/system-settings.html
i had this problem in webstorm when a script file was running and i was editing it in webstorm. when i stopped the script and edited it everything was fine
it's a temporary file used by PyCharm to make sure you change will not be lost when editing files. it's safe to delete them manually, you will only loss very recent changes. IntelliJ IDEA works the same as PyCharm.
How to delete them?
To delete a file on a file system requires two things: 1)you have the permission. 2)no program is using it.
so make sure you have 'w' the permission, and stop all program which is using it. then you can remove it.
How to know which program is using it?
Normally you should already know it. but sometimes some background programs(like crash plan, google drive sync, e.g.) may also hold it quietly, then find and kill all programs may be very tricky. the easiest way is reboot your computer with 'safe mode', in which only the OS kernel is loaded.
I spend two hours to figure out the reason why I cannot delete the temp file even when I have whole permission. a crash plan service is holding it in background. This may not be your issue, but if you cannot delete the temp file, this will save your time.
While JeremyWeir's solution probably does work, the real fix - imo - is to enable write permission on the directory.
Saving a file would only need write permission to that file itself. But with the "safe write", you need permission to create the file and rename it - which means you need write access to the directory.
In Linux this would be e.g. chmod ug+w DIR, if you want to give write access to user and group.
I have exact same issue with PhpStorm after system crash. The fix I found was to manualy delete *._jb_old_ and *._jb_bak_ files and reinstall PhpStorm

Jailshell on cpanel - Allow access to additional folders

I've not been able to find a solution to this problem.
I'd like clients I give jail-shell access to (rather than normal shell access) the ability to run commands I allow access too, such as Git.
Git requires you include the folder /usr/local/libexec/git-core but I can't work out a way of including the folder for jail-shell access ?
Perhaps it's not even possible, but I'm keen to find out.
You can mount additional directories in /var/cpanel/jailshell-additional-mounts
If the file doesn't exist create it and put the directories which you want to allow into it, one directory name per line:
/usr/local/libexec/git-core
/usr/local/lib
...

SVN: how to lock a file so that no one can modifiy it?

We are using TortoiseSVN for a project. One file in this project has a special status. It can be modified locally but the SVN version must not be modified.
So, I have locked the file so that noone, unless me, can modify this file. Now I am searching a way so that even me cannot modify this file. Do you know if it is possible and how?
Thanks for your answer.
Add a serverside pre-commit hook that rejects commits touching that file.
See http://wordaligned.org/articles/a-subversion-pre-commit-hook
There is an example function listing all affected files. To make the script reject the commit, write "You cannot modify THENAMEOFTHEFILE" to STDERR and exit with an error code. For example sys.stderr.write("ProjectThingyFile.txt is read-only.\n"); sys.exit(1)
Does it need to be part of the SVN repository as you can ignore it so it will not be committed and can remain unique per users machine.
Find the file right click on it
goto the tortoiseSVN Menu
Unversion and add to ignore list or add to ignore list
This process will stop any changes to that file being committed from any user
Tortoise SVN Documentation on this
Hope this helps
Jason
You could create a dummy user that no one logs in as and have that user lock the file instead of yourself.