Rsync error with long file name - cygwin

I have problem with long file name using rsync (version 3.0.4 protocol version 30) in cygwin (on Windows 8.1)
Rsync give me error: "some file name" failed: File name too long (91)
In detail
command:
rsync -r -t -v --modify-window=1 --log-file="E:\!SAFE\SYSTEM\SKRIPTE\log_detaljni_wamp.txt" /cygdrive/c/wamp/ /cygdrive/j/Lenovo/C/wamp >> E:\!SAFE\SYSTEM\SKRIPTE\log.txt
error:
2016/09/20 11:59:34 [9140] rsync: mkstemp "/cygdrive/j/Lenovo/C/wamp/www/wiki/images/thumb/2015-05-22_14_20_42-How_to_fix_the_there_was_a_problem_sending_the_command_to_the_program_Excel_er.png/.120px-2015-05-22_14_20_42-How_to_fix_the_there_was_a_problem_sending_the_command_to_the_program_Excel_er.png.XgcKIu" failed: File name too long (91)

Window has a maximum length for the whole file path.
It's not just an rsync problem: https://support.microsoft.com/en-gb/kb/2891362 (I believe the "fix" listed on that page is for the Windows Explorer mis-behaviour, not a solution to the underlying limitation).

Related

How to apply the OSPF patch to ns2 2.35 on ubuntu 14.04

I have been using ns2 and nam for a long time on my ubuntu. Now I have to apply a patch (OSPF) to it. I have been searching for how to apply a patch in linux (as I'm kind of new in it) and all I got was:
1) $ tar xvf ns-allinone-2.35.tar.gz
2) $ cd ns-allinone-2.35/
3) $ ln -s ns-2.35/ ns-2.34
... Then the patch will work, except for one line. (commom/packet.h).
4) $ patch -p0 < 10-ospf4ns2.34-base.patch
http://sourceforge.net/projects/ospf4ns/
5) Replace commom/packet.h with the attached "packet.h" : Edited by hand.
6) export CC=gcc44 CXX=g++44 && ./install
I untared the tar file, copied the .patch file in the ns-allinone-2.35 folder called 10-ospf4ns2.34-base.patch, gone to the directory in a terminal, used ln -s ns-2.35/ ns-2.34 and then patched using line 4. After that I have these messages:
The next patch would create the file ns-2.34/classifier/classifier-mtopology.cc,
which already exists! Assume -R? [n] y
patching file ns-2.34/classifier/classifier-mtopology.cc
The next patch would create the file ns-2.34/classifier/classifier-mtopology.h,
which already exists! Assume -R? [n] y
patching file ns-2.34/classifier/classifier-mtopology.h
can't find file to patch at input line 92
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- ns-2.34.old/common/agent.cc 2009-06-14 18:35:45.000000000 +0100
|+++ ns-2.34/common/agent.cc 2010-02-26 23:34:33.161063590 +0000
--------------------------
File to patch:
After this I don't know what to do. What file should I patch? There is no classifier-mtopology.h in ns-2.34.
And after that, which packet.h should I replace with the specified new packet.h? Because there are several common folders. Any help would be much appreciated cause I'm a novice in linux.
It looks like you already applied the patch before (at least partially) and that you are not in the correct directory.
Start again, also you can avoid the symlink with the following instructions:
Extract ns-allinone-2.35.tar.gz in a fresh directory.
cd ns-allinone-2.35/ns-2.35
Apply the patch with:
patch -p1 < 10-ospf4ns2.34-base.patch

How to use zipnote command?

I'm trying to use zipnote to rename files in an zip archive but I can't figure out how to use it properly. There's already a similar question but it doesn't work for some reason.
When I try to use:
printf "# myfile.txt\n#=myfile2.txt\n" | zipnote -w archive.zip
I just says:
zipnote error: Bad file descriptor
zipnote error: Temporary file failure (ziMZslgn)
This throws exactly the same error message which is weird to me:
zipnote test.zip > a.txt
zipnote -w test.zip < a.txt
I'm running OS X 10.9 but the manual page doesn't mention any difference to the standard linux zipnote.
edit: On Debian 6.0 it returns:
zipnote error: Bad file descriptor
*** Error in `zipnote': free(): corrupted unsorted chunks: 0x0000000000d962e0 ***
zipnote error: Temporary file failure (ziw8B942)
*** Error in `zipnote': double free or corruption (!prev): 0x0000000000d962e0 ***
This has been fixed in zip 3.1 beta

Exit codes of smbclient

i've a problem with the commandline command "smbclient" of samba on arm.
I wrote a script to download files from a Windows Share.
Here the smb-part of this script.
smbclient //CNAME/SNAME -I0.0.0.0 -N -c "case_sensitive; cd folder; prompt; mget file"
echo $?
My problem ar the exit codes.
If the file is downloaded completely, the exit code is 0 (OK)
If the file cannot be downloaded, the exit code is 1 (OK)
If the testmaschine loses the connection to the share due downloading a file, the exit code is 0 (NOT GOOD), but error ("Lost connection...etc.") is written to console. (OK)
I tried it with two different versions.
samba-3.0.32
samba-3.6.19
Both the same.
Does someone know a good workaround (or smbclient-argument) to let my script know, that the download failed?
PS. I checked the smbclient sources. It looks like they forgot to set the exitcode. Because everytime there is another error the set the Errormessage and do an (e.g. exit(1)). But for timeouts, they only set the Errormessage.
Thank you in advance!
What would be best is to use the -E argument to smbclient and redirect 2>/errorlog from the command line. You can then check this file to see if any errors occurred.
Warning, the first line is always the Domain=......... so you may need to strip that line out.
Something like this:
smbclient Hostname -A authfile -E 1>log 2>errorlog <<-EOF
get foo
EOF
In the errorlog you should find something like below, your log file will be empty
Domain=[Hostname] OS=[Windows Server 2008 R2 Standard 7601 Service
Pack 1] Server=[Windows Server 2008 R2 Standard 6.1]
NT_STATUS_OBJECT_NAME_NOT_FOUND opening remote file \foo

Naming a tar file with date

I want to name a tar file with the date, but what i try isn't working, see the code below for better explanation, and what a i have to do?
date=$( date +%Y-%m-%d_%H:%M:%S )
tar -czf ${imageName-$date}.tar.gz ${imageBasename} 2>>$ERRORLOG
The image name is a variable that stores a name of an image, like: win-ser-rdp
I had tried too:
tar -czf ${imageName}:${date}.tar.gz ${imageBasename} 2>>$ERRORLOG
Didn't work out too :(
Thanks to all the help :D
The problem is the : in the file name, which is treated specially by GNU tar.
On my own system, where I have a directory named foo, I get this:
$ tar zcf foo:42.tar.gz foo
tar (child): Cannot connect to foo: resolve failed
tar: Child returned status 128
tar: Error is not recoverable: exiting now
$
There doesn't seem to be any way to escape the : character -- but you can inhibit the special interpretation with the --force-local option (thanks to Daniel Serodio for pointing this out).
Colon characters in file names, though they're legal, are typically a bad idea anyway. For example, you probably wouldn't be able to access the file via scp.
Here's the relevant section from the GNU tar manual (info tar and go to section 6.1):
To specify an archive file on a device attached to a remote machine,
use the following:
--file=hostname:/dev/file-name
tar will set up the remote connection, if possible, and prompt you for
a username and password. If you use --file=#hostname:/dev/file-name,
tar will attempt to set up the remote connection using your username
as the username on the remote machine.
When I make file names that include a timestamp, I usually use YYYY-MM-DD-HHMMSS
$(date +%F-%H%M%S)
or you can use YYYY-MM-DD_HH_MM_SS if you prefer
$(date +%F-%H_%M_%S)
Your filenames and variables are incorrect:
${imageName-$date}
Should be
${imageName}${date}
and
${imageName}:${date}.tar.gz
is going to be interpreted as an NFS location because of the : in the name, e.g. server:filename. Replace the : with a - or other non-special character.
try avoiding all colons in the tarfilename, as this will make tar attempt to output to a remote file:
date=$( date +%Y%m%d_%H%M%S )
tar -czf ${imageName}-${date}.tar.gz ${imageBasename} 2>>${ERRORLOG}

Error while running my run.sh (linux)

I recently encountered this error while running my run.sh. I am trying to run a Runescape Private Server on my linux VPS; this is a large error. Please assist me, I dont know what other details to add.
Error:
jacob#ace:~/Server/source$ sh run.sh
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-server to select the "server" VM
The default VM is server,
because you are running on a server-class machine.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A : separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose:[class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -no-jre-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions with specified granularity
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
run.sh: 1: run.sh: deps/poi.jar: Permission denied
run.sh: 1: run.sh: deps/mysql.jar: Permission denied
run.sh: 1: run.sh: deps/mina.jar: Permission denied
run.sh:
java -Xmx800m -cp bin;deps/poi.jar;deps/mysql.jar;deps/mina.jar;deps/slf4j.jar;deps/slf4j-nop.jar;deps/jython.jar;log4j-1.2.15.jar; server.Server
read
Add #!/bin/sh -vx as the first line of your run.sh script (to get a trace of he shell).
You probably need to quote the classpath, i.e.
java -Xmx800m -cp 'bin;deps/poi.jar;deps/mysql.jar;deps/mina.jar;deps/slf4j.jar;deps/slf4j-nop.jar;deps/jython.jar;log4j-1.2.15.jar;' server.Server
read
I strongly suggest to take a few hours to read the advanced bash scripting guide.
You must change ; to : of that i'm 100% sure!
Maybe that will fix your errors.
revision 718 RSPS runner(maybe useful for others searching this):
#!/bin/bash
nohup java -cp bin:lib/*: com.rs.Launcher true true false

Resources