CopSSH + Git: path issue - ssh

I'm confused.
I've installed copSSH and linked it with msysgit installation (by adding path to it).
And now whenever I use copSSH tools (like ls, cd) I should use the absolute paths in form like '/home', /cygdrive/d/copSSH/home.
But when I used git I should use absolute paths in a different (another) form.
like '/copSSH/home', 'd:/copSSH/home'.
For me it's really strange.
Have anybody clue for that and an idea how to fix it?
Thanks a lot Andrei.
P.S. I use WinXP, git version 1.7.0.2.msysgit.0, copSSH 3.1.0.
Everything is installed using
http://www.timdavis.com.au/git/setting-up-a-msysgit-server-with-copssh-on-windows/
article (with some modifications).

Unfortunately, cygwin and mingw have a different way of mapping windows drives and directories, so before you enter a path for anything, you need to know whether it is a cygwin or mingw binary.
What I can suggest is to remove CopSSH bin directories from your PATH (at least from git bash path), so that all shell commands available use the mingw format. The only place where you would have cygwin paths would be when you do and ssh actions this way. For example, when you clone from d:\repositories\myrepo.git, you could use git clone ssh://user#srv/cygdrive/d/repositories/myrepo.git (cygwin form). To work with git in, say d:\clones\myrepo, you can use ls /d/clones/myrepo (mingw32 form).
Also, before you attempt any git clones, you can use putty or plink to make an ssh connection, and look around. If inside the ssh connection, you can do ls /home/myrepo.git, then git clone ssh://user#srv/home/myrepo.git should work.

Please try this format
git clone gituser#sshserver:myapp.git

Related

Singularity Recipe: How to access executable within container?

I am a beginner with Singularity.
What I want to achieve in the long run: I have a programming project with a long lists of dependencies, and I want to be able to give the program to other people in my company without there being bugs caused by missing dependencies, or wrong versions of dependencies.
The idea was now to use Singularity in order to easily provide a working environment.
In order to test this, I wrote a Hello World application which I now want to run in a container. I have a folder HelloWorld/ which contains the source code for a C++ Qt project. Then I wrote the following recipe file:
project.recipe
Bootstrap: docker
From: ubuntu:18.04
%setup
cp -R <some_folder>/HelloWorld ${SINGULARITY_ROOTFS}/HelloWorld
%post
apt update
apt-get install -y qt5-default
apt install -y g++
apt-get install -y build-essential
cd HelloWorld
qmake
make
echo "after build:"
ls
%runscript
echo "before execution:"
ls HelloWorld/
./HelloWorld/HelloWorld
where the echos and directory listings are for my current debugging process.
I can sucessfully build an image file using sudo singularity build --writable project.img project.recipe. (My debugging output shows me that the executable was build successfully.)
The problem is now that if I try to run it using ./project.img, or singularity run project.img, it won't find the executable.
Using my debugging output, I found out that the lines in %runscript use the folders outside of the container.
Tutorials like https://sylabs.io/guides/3.1/user-guide/build_a_container.html made it seem to me as if my recipe was the way to go, but apparently it isn't?
My questions:
Is there some way for me to access my executable? Am I calling it wrong?
Is the way I do it the way it is supposed to be done? Or would one normally do something like getting the executable outside of the container and then use the container to call that outside file? Or is there a different best practice?
If the executable is to be copied outside of the container after compilation, how do I do that? How do I access outside folders when I'm within %post?
Is this the best work process for what I want to achieve? Later on, my idea is that the big project is copied likewise in the container, dependencies are either installed or copied, then the project is compiled and finally its source being deleted. I also considered using a repository, but I can't have the project being in an open repository, and I don't want to store any passwords.
Firstly, use %files, don't use %setup. %setup is run as root and can directly modify the host server. You can very easily and accidentally break things without realizing it. You can get the same effect this way:
%files
some_folder/HelloWorld /HelloWorld
You are calling it wrong. In your %setup (and hopefully now in your %files) steps, you are copying the data to /HelloWorld. In your %runscript your are calling ./HelloWorld/HelloWorld which is the equivalent of $PWD/HelloWorld/HelloWorld. Since singularity automatically mounts in $PWD (as well as $HOME and some other directories), you are not calling what you're trying to call.
You don't copy the executable outside of the container, you just need to make sure what you're executing is where you think it is.
There is no access to the host filesystem in %post, you should have everything you need copied in via %files first.
That's a reasonable workflow. Having a local private repo for the code is probably a good idea for tracking your changes, but that's your call.

redis-cli not working on linux

I have installed redis onn linux.
redis sever started correctly however when I try to start redis-cli I get this error
bash: redis-cli: command not found
file redis-cli output is
ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, BuildID[sha1]=0x5fe1c6d3da13df88f2ea826ac762f088c29b81d5, not stripped
I don't know what's the reason
but when I run the using this command
/usr/local/bin/redis-cli it works
but when I run redis-cli from the /usr/local/bin/ folder I get the error
bash: redis-cli: command not found
Looks like some path issue
If you built from source and you're in the default redis-stable directory that contains the source, you should be able to start the cli by running:
./src/redis-cli
It seems like redis-cli is present, reading your answer. Check this with which redis-cli.
I've installed redis on several linux machines, normally it goes very smooth. I guess you've run into a special case.
Here's my thoughts:
It might be a dynamic linking issue.
So check the headers with dump -H -X64 redis-cli.
In the headers, you can see which shared objects it is trying to find. There might be a shared object from another package in the way, for example a 32-bit only one. Ugly, and wrong, but it happens.
Use the ldd runtime dependency checker to see what those headers actually result in on your system. Install it when not present. Then simply run ldd redis-cli.
Now you've figured out what's wrong, you can do several things.
1) Remove the conflicting package, if possible.
2) Use the LIBENV environment variable, to set the search path for shared objects, prior to starting the process
3) Use the -blibpath linker option at compile/link time to alter the header, giving it a different search path. The -bnolibpath could also help you.
4) Patch the header afterwards. There are tools for this. This is generally not the preferred way to go.
Hope this helps, TW
Edit:
Although make, make test, and make install were always fine, the server install script install_server.sh was always a bit buggy. This has just been fixed in 2.8.8. I recommend using the latest version.
Edit 2:
The OP's problem turned out to have nothing to do with dynamic linking, it was a simple PATH issue. I leave the answer as is, for historical purposes.
This maybe happening because the executable isn't in path. In order to solve this, you can try copying redis-cli on the /usr/local/bin/ folder with this command:
sudo cp /src/redis-cli /usr/local/bin/

How to use gitbash instead of windows cmd.exe with meteor Release 0.7.0.1-win2

I am getting started with Meteorjs. I'm a windows user so I downloaded the windows installer package Release 0.7.0.1-win2. I use gitbash for my command line interface and can't get it to recognize meteor. I get the error "sh.exe": meteor: command not found". It works fine in windows command line but I prefer gitbash.
How do I get meteor to work with gitbash?
I have the perfect answer for you since I literally just solved the issue myself.
First of all make sure meteor works in the default windows command prompt. Next open git bash and check if the following command works:
cmd //c meteor
This runs the command meteor as if you were in the command prompt.
Next step is to set up an alias in git bash so you don't have to type that out each time.
Open git bash and enter the following:
vim ~/.bashrc
this will open/create the bashrc file in VIM, press i to insert and type the following:
alias meteor="cmd //c meteor"
Save and exit vim by first pressing the Esc key then press the ":" key. Now you should be able to enter commands in VIM. Type "wq" and press enter which will write into your .bashrc file and exit vim.
Almost there! Now that you are back in git bash, all you need to do is point to your .bashrc file by entering the following:
source ~/.bashrc
Now you will be able to run meteor commands straight from git bash! Hope that helped!
Here's the fix:
The problem is because of .bat files not being handled properly by
MinGW
Go to this directory - C:\Users[your username]\AppData\Local\.meteor
You should see a meteor.bat file there. Create a new file called "meteor" (without any extension and ""). Open it with notepad and paste the following:
#!/bin/sh
cmd //c "$0.bat" "$#"
save the file and now run git bash. You should be able to use meteor command in git bash.
Details
To run a *.bat command from MinGW's MSYS shell, you must redirect the execution to cmd.exe, thus:
cmd //c foo.bat [args ...]
The foo.bat command file must be in a directory within $PATH, (or you must specify the full path name ... using slashes, not backslashes unless you use two of them for each path name separator). Also, note the double slash to inform cmd.exe that you are using its /C option, (since it doesn't accept the -c form preferred by the MSYS shell.
If you'd like to make the foo.bat file directly executable from the MSYS shell, you may create a two line Bourne shell wrapper script called simply foo alongside it, (in the same directory as foo.bat), thus:
#!/bin/sh
cmd //c "$0.bat" "$#"
(so in your case, you'd create script file meteor alongside meteor.bat).
In fact, since this wrapper script is entirely generic, provided your file system supports hard file links, (as NTFS does for files on one single disk partition), you may create one wrapper script, and link it to as many command file names as you have *.bat files you'd like to invoke in this manner; (hint: use the MSYS ln command to link the files).
Credits to: Keith Marshall on SO and rakibul on Meteor Forums
It shouldn't be too hard - you just need to make sure that the meteor.bat file is in your executable. Check with echo $PATH from the bash console if it is already there.
For me, the meteor 0.7.0.1-win installer appended meteor's folder to the path automatically. However, you can add it manually with:
export PATH=$PATH:/path/to/user/folder/AppData/Local/.meteor
(On CygWin my user folder is at /cygdrive/c/Users/adam - I'm not sure what the equivalent path would be on git bash).
If you like, append that line to your ~/.profile to make sure meteor gets added to the path when the console opens.
Finally, on Windows the executable file is meteor.bat. I made a symbolic link to the filename meteor, just so I wouldn't have to type the .bat:
cd /path/to/user/folder/AppData/Local/.meteor
ln -s meteor.bat meteor.
Please have a look at the issue https://github.com/sdarnell/meteor/issues/18
I would suggest maybe creating a trivial wrapper script or alias that invokes LaunchMeteor.exe with the original arguments.
After more research on google I see that there isn't an implemented way to do this yet. The guys at meteor are working on it and accepting pull requests if you have a solution. The conclusion I came to is to use Vagrant and virtualbox to set up a ubuntu vm for meteor development. You can find info at this site: http://win.meteor.com/ on how to install virtual machines and provision to work with meteor.

Class-Dump Installation

So this may sound like a really stupid question and I HAVE looked at the how-to from the parent website, but no matter what I do, I cannot get this program to even start to install...
I tried entering:
cd /opt/local/bin/portslocation/dports/class-dump
which returned a "this file/director doesnt exist" error, so i tried to get to it folder by folder. when i got all the way to:
cd /opt/local/bin/
i cannot go any further. when i check the contents of the bin directory, the only files i can find are (and i cannot access these apparently either):
"daemondo port portf portindex portmirror"
i have tried doing this on 2 computers so far to no avail, macports is installed on both like the website said and i am having trouble finding any support for it. please and thank you!!
Unless you're trying to develop it, why screw around? Use homebrew. As of today, and modulo a sudo here or there, you can install homebrew with
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
If this doesn't work for you, check the command line at the top of the page on homebrew.†
After this, install class-dump with
brew install class-dump
Done.
† Ping me in the comments with "command line update needed", and I'll try to keep this in sync. :)
I had issues with this for hours, but it is actually quite simple.
I downloaded the class-dump 3.3 version from CodeTheCode, Unzipped the file and copied the class-dump file to a directory. In my case the directory was /opt/theos/bin.
In terminal, I then CD to that directory using cd /opt/theos/bin
To run the class dump command line utility it is as simple as this;
./class-dump
Obviously you then need to give it it's arguments, so in my case I was using it do dump the iOS headers from the frameworks, so I used;
./class-dump -H /Developer/Library/iPhoneSimulator4.3.sdk/Frameworks/UIKit.framework/UIKit -o ~/Desktop/UIKit
Obviously I am not sure what you are using it for, but in the example above I am telling class-dump to dump header files from the directory given, and output them to /Desktop/UIKit.
The theory is carried throughout.
Have you tried getting the binary from http://www.codethecode.com/projects/class-dump/?

Why does the building from Binary files do not require Root access?

When I am in my dept's server, I cannot use commands such as "apt-get install nethack". I have to build the nethack from Binary files to get it working, at least so I have been told. I cannot understand the reason. Why do I need to build things from binaries? Why is the use of the commands, such as "apt-get", forbidden? Why do I not need Root access to build from binaries?
apt-get is a system-level command that installs packages for all users.
If you download and compile, you are only creating local "copies" of the binaries, not system-wide. If you tried to complete the install process with make install this would most likely fail because you do not have sufficient privileges to install the program for all users' access (same reason you can't run apt-get install)
When you compile a program from source, you can give it the '--prefix=~/'. This causes it to install relative to your own home directory (so binary programs typically end up in '~/bin', man pages in '~/man' etc). This poses no problems because you already have permission to write here.
Apt-get on the other hand installs the packages in the global filesystem ('/bin/', '/usr/bin/', etc), which can impact other users and so, quite rightly, require administrative access.
If you want to install some program you can use the command
apt-get source app-name
This will work even if you are not root since it only fetch the source code to the app-name and put it in the current directory, which is easier than having to track down the source and there is a better chance to get it work, since you download the version that should work on your system.
Alternatively you should bug your sysadmin to install the programs you need, since it is his job (and if you need them, chances are that the rest of your team does too).
Because apt-get will install a program system wide.
The locations to which apt-get writes installed files (/bin, /usr/bin, ...) are restricted to root access. I imagine that when you build from source you're not executing the install step of the bulid. You're going to need to set a prefix for the installation such that the packages end up somewhere you can write. This thread talks a bit about setting prefixes for apt-get and you'll probably want to set your prefix to something like
~/software/
and then add the resulting bin directories to your PATH.