Why Can't I Run Valgrind on Another User's Executable? - permissions

I want to run Valgrind on an executable built by another user on the same system. When I do this, I do not receive line numbers for errors, which nearly defeats the purpose. Instead, I get errors which look like the executable was built without a symbol table, or like I cannot read the files.
Things I have checked:
The running user has read permission on all the source files, and the directories they are in files.
running with sudo -u running_user doesn't work, but, without recompiling, running with root permissions does work.
What permissions does Valgrind need in order to operate? Is this error caused by something other than permissions?

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

Check files have execute permission using CMake

I have a CMakeLists.txt that requires certain input files to have write permissions, otherwise the make process fails with a rather obscure "Permission denied Error 126" message. The page here describes the usage, with the key points being:
In order to make this cfg file usable it must be executable, so lets use the following command to make it executable
chmod a+x cfg/Tutorials.cfg
Next we need to add the following lines to our CMakeLists.txt. For Groovy and above
generate_dynamic_reconfigure_options(
cfg/Tutorials.cfg
#...
)
add_dependencies(example_node ${PROJECT_NAME}_gencfg)
How would I alter the above snippet so I could do something sensible if I forget to run chmod on cfg/Tutorials.cfg thus it is not executable?
As described in the key points, you must make the file executable by chmod 0555 but you have to be cautious when doing this. By chmod 0555, even the owner of the file, other than root, is denied write privileges. I recommend using 0775 or something else better as it grants read and write permission.

Showing ‘fetching’ for user permission in plist file inside the cocoa app bundle

In my cocoa application, i am using one plist file(preference.plist) to save the preference inside the app bundle. I am using package maker to pack my app(Business requirement). For that, i will build my app and export as a Developer ID-Signed application. If i check the sharing and permission info of my app, it will show like this
In my local system, i can write on this preference.plist file with this user permission. If i install the same in my client machine, it shows fetching for all the time.
In this case, i can't write in preference.plist file. Don’t know why this strange behaviour occurs for my app. Hope the above scenes will explain my problem. Please provide the solution to accomplish this issue.
You should not store writable files in your app bundle, especially if you then intend to sign the bundle.
If you cannot store your preferences in your apps user defaults then your app should create a directory to hold its files, usually named after its bundle ID, in user or system Application Support directory - you can find its URL using URLsForDirectory requesting NSApplictionSupportDirectory.
Doing the above should solve your permissions problem (and work correctly if sandboxed).
HTH
Yes, i got a reference from this link
When copying a file between one system and another, occasionally both the permissions and owner for the files will be incorrect. You may need to change the owner of the file because the file is unable to be edited by the user due to permissions issues.
We’ll rely on the “chown” command to change the owner of a specified group of files, right from the command line.
chown command:
sudo chown -Rv $USER /Applications/TEST.app
This command works fine. Now in permission area, its not showing "fetching". I have included this command in package maker post script.

How can I bundle a command line utility in os x application on Mac App Store (using sandbox entitlement)

I have a c++ command line application that I have already compiled into an executable and have added it into my Xcode project. I have also added the "Copy Files" section to the Build Phases tab of the project properties and added my executable with the "Executables" destination. When I build my application I see it in the test.app/Contents/MacOS folder when I View package contents on the test.app that is built.
I also have App Sandbox enabled on the Capabilities tab of the project (so that I can distribute my application through the mac app store.
How can I expose this command line executable that is bundled with my application to the user so that they can run it from the command line (terminal)? I have not been able to find anything on search engines or on StackOverflow about how to get this file (or a symlink to this file) into the users PATH. I tried using an NSTask to create a symlink, but that only works if I disable the App Sandbox (which makes sense). Has anyone done this before? How did you get it to work? Or can these executables only be executed by code within your application?
I don't see a good way to do this. First, a clarification: the PATH is a list of directories that contain executables, not a list of executables; there's no way to add a single executable to the PATH. Instead, what you'd need to do is either put your executable into one of the directories in the user's PATH, or add the directory your executable is in into the PATH.
On OS X, the default PATH is /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin. The first 4 directories shouldn't be modified from the system default, so only /usr/local/bin is a possibility. But creating it (it doesn't exist by default) would require admin (actually root) rights, which isn't allowed by App Store policies. So that's out.
That leaves modifying the user's PATH. The "right" way to do that system-wide is by placing a file in /etc/paths.d, which requires admin (/root) rights, so that's out too. Technically modifying the /etc/paths file would work, but that has the same permissions problem plus it's the wrong way to do customization.
The next possibility is to modify (/create) the user's shell initialization script(s). This'll work, but doing it at all right is going to be messy, because there are several shells the user might use, each with several different possible initialization scripts that the user might or might not have created...
Let's take a very simple case: a user who only ever uses bash, and who doesn't already have any initialization scripts. When a "login" instance of bash starts, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile (in that order), and runs the first one it finds. But your app doesn't know which shell he uses, so you'd better create ~/.profile so zsh and ksh will use it as well. So, your app creates ~/.profile, and puts this in it:
PATH="$PATH:/Applications/MyApp.app/Contents/Helpers"
Great, right? Yup, great, until the user runs something else that wants to set their PATH, it creates ~/.bash_profile, and this overrides your setup. After that, your executable will be in the PATH of zsh and ksh, but not bash. Whee.
And then one day the user decides to use tcsh instead, and it (and csh) have a completely different but equally messy pile of possible init files...

Team City build agent work dir not getting changed

I want to change the build dir of team city build agent to:
E://MY_PROJECT_SVN
While installing the build agent I set the same but it diaplays C://buildAgent/work in TeamCity web ui due to which my build fails.
My buildAgent.properties file shows
workDir=E\:\\MY_PROJECT_SVN
And buildAgent.dist.properties file shows
workDir=E://MY_PROJECT_SVN
But I get following error when I run team city
Failed to start MSBuild.exe. Failed to find project file at path:
C:\BuildAgent\work\3ac16e0b4e3af05b\Modules\SIM5.sln
Because of wrong working dir
The buildAgent.dist.properties is indeed just an example, but the solution is something you almost had; you need to put this into the buildAgent.properties:
workDir=E:/MY_PROJECT_SVN
Update:
It should be noted that on TeamCity 7.0 the workDir seemingly can't be on a separate disk; it runs most of the way through the build and then fails. However, using a junction to point from the local (default) folder to the E: drive will work. The tempDir can be pointed to a remote disk though.
The file buildAgent.dist.properties is not used, it is just an example. So don't worry about the contents of that file.
What you have set in buildAgent.properties is what matters. What is happening for you is the agent is reverting to the default location for the working directory.
This means that for some reason it is not able to read or parse the buildAgent.properties file. Make 100% certain that the entire file has no errors in it.
https://confluence.jetbrains.com/display/TCD8/Build+Agent+Configuration
Making any change to this file and saving it should cause the build agent to reboot automatically and reload the new config once it has restarted.
http://blog.jetbrains.com/teamcity/2007/10/configuration-files-editing-without-teamcity-restart/
To build on paul-f-wood's answer:
Teamcity 9.1.6 also has the "feature" where the work directory cannot be on a different drive. I tried several permutations of the temp and work dir, and the only ones that stuck were with the work dir on the same drive as the root teamcity folder. However as paul said, using a junction works like a charm.
cmd: rm C:\BuildAgent\work
cmd: mklink /J C:\BuildAgent\work E:\MY_PROJECT_SVN