nasm with long (or absolute) path unable to open output file (on cygwin) - cygwin

I spend a lot of time and can't understand why nasm "unable to open output file".
If I call nasm from the folder containing my asm file it works (with relative path) but won't work with absolute path :
XXX#YYY /cygdrive/c/Perso/Code/boringssl/crypto/chacha
$ /cygdrive/c/Program\ Files/NASM/nasm.exe /cygdrive/c/Perso/Code/boringssl/crypto/chacha/chacha.asm
/cygdrive/c/Perso/Code/boringssl/crypto/chacha/chacha.asm: fatal: unable to open output file `/cygdrive/c/Perso/Code/boringssl/crypto/chacha/chacha'
XXX#YYY /cygdrive/c/Perso/Code/boringssl/crypto/chacha
$ /cygdrive/c/Program\ Files/NASM/nasm.exe chacha.asm
>>>> This will work
I try with some relative path and find this
XXX#YYY /cygdrive/c/Perso/Code/boringssl/crypto/chacha
$ /cygdrive/c/Program\ Files/NASM/nasm.exe ../../../../../../c/Perso/Code/boringssl/crypto/chacha/chacha.asm
../../../../../../c/Perso/Code/boringssl/crypto/chacha/chacha.asm: fatal: unable to open output file `../../../../../../c/Perso/Code/boringssl/crypto/chacha/chacha'
XXX#YYY /cygdrive/c/Perso/Code/boringssl/crypto/chacha
$ /cygdrive/c/Program\ Files/NASM/nasm.exe ../../../../../Perso/Code/boringssl/crypto/chacha/chacha.asm
>>>> This will work
I can't make it work with absolute path, even with "/tmp/chacha.asm"
I also try with 2 different version of cygwin but same results.
My nasm version is "NASM version 2.15.05 compiled on Aug 28 2020"
I can't figure out what nasm need to work with an absolute path (or big relative path)

You are using a Windows NASM, as such it can NOT understand cygwin specific path as
/cygdrive/c/Perso/Code/boringssl/crypto/chacha
Or you use Windows PATH or you use the Cygwin NASM package
https://cygwin.com/cgi-bin2/package-cat.cgi?file=x86_64%2Fnasm%2Fnasm-2.13.01-1&grep=nasm

Related

Is it possible to get kernel version from ELF image file without disassemble or using grep or strings?

I have a vmlinuz ELF image file. I need to get the kernel version from the image file without disassembling it. Is it possible to get kerenel version from offsets of that compressed image file? The file is ELF 64-bit MSB executable, statically linked, not stripped.
As previously mentioned, the version number is hardcoded into the compressed image file. First it depends on the compression algorithm used to compress the content, how to decompress it.
Decompressing files in linux could be challenging due to the combination of compression algorithms and the correlated tool options (not to forget a newer version of tar for newer algorithms).
For files with
file extension tar.gz, tgz use e.g. $ tar -xzv -f vmlinuz.tgz
file extension tar.xz, use e.g. $ tar -xJv -f vmlinuz.tar.xz
file extension tar.bz2, use e.g. $ tar -xjv -f vmlinuz.tar.bz2
So if you have access to the file utility (should also run on windows), run the following to receive the version string and additional information of your file named e.g. vmlinuz-4.x.y-z-a.
file vmlinuz-4.x.y-z-a
Another possibility to reverse-engineer would be to read all strings of the binary file vmlinuz-4.x.y-z-a and grep for a part of the possible solution.
strings vmlinuz-4.x.y-z-a | grep 'linked,'

exiftool system cannot find path

I want to use exiftool to change the names of my files in one directory to the creation time (I'm on Windows 10).
I "installed" exiftool under C:\Windows as recommended.
I also set the path for exiftool.
I created a directory under the path C:\testordner where I copied all
my files into.
I opened the commandline in windows.
When I enter the command: C:\testordner>exiftool . everything works and i get the exif data of all files inside this directory.
When I enter the command: C:\testordner>exiftool IMG_0160.JPG it works too.
After reading the documentation I tried the following command to change the filenames of all my files in the directory to the creationdate:
C:\testordner>exiftool '-FileName<DateTimeOriginal' -d "%Y-%m-%d %H.%M.%S%%-c.%%e" .
When I try to run this command I always get the error message: "System cannot find the specified file" (In german: Das System kann die angegebene Datei nicht finden.)
I also tried:
C:\testordner>exiftool '-FileName<CreateDate' -d %Y-%m-%d_%H.%M.%S%%.%%le .
What do I do wrong? I don't get it.
From the exiftool main page, Running in Windows:
"Note that when typing commands in the "cmd.exe" shell, you should use double quotes instead of single quotes as shown in some examples"
Under Windows CMD, change the single quotes to double quotes and your command works correctly.

vim change base of relative path to source to other dir

I have a local Makefile which simply calls make -C ... As a result I get the output from the compiler with filenames and path to the directory relative to ...
Now vim isn't able to get the correct path for quickfix.
Q: How can I set the base path for vim quickfix to .. ?
My path structure:
<bla>/base/proj1/<localMakeFile>
<bla>/base/<globalMakefile>
<bla>/src/source1.cpp
I compile inside /base/proj1/
Compiler output for a error is like:
src/source1.cpp|141 col 54| Error: ....
But I am working in
/proj1/ so vim is unable to get the file src/source1.cpp
EDIT:
I see that the problem is basically related to the output of gnu make
make[4]: Entering directory '<bla>/...'
which is not parsed correctly if I use not an English environment. Setting the shell with export LANG= all works fine.
Q: Can vim parse also the German output of gnu make?
Appending the localized version with set errorformat+=<localized version> should work.
I am not aware that VIM supports it out of the box. After looking at the output of :set errorformat, which on my machine is a scary...
errorformat=%*[^"]"%f"%*\D%l: %m,"%f"%*\D%l: %m,%-G%f:%l: (Ea
ch undeclared identifier is reported only once,%-G%f:%l: for ea
ch function it appears in.),%-GIn file included from %f:%l:%c:,
%-GIn file included from %f:%l:%c\,,%-GIn file included from %f
:%l:%c,%-GIn file included from %f:%l,%-G%*[ ]from %f:%l:%c,%-G
%*[ ]from %f:%l:,%-G%*[ ]from %f:%l\,,%-G%*[ ]from %f:%l,%f:%l:
%c:%m,%f(%l):%m,%f:%l:%m,"%f"\, line %l%*\D%c%*[^ ] %m,%D%*\a[%
*\d]: Entering directory %*[`']%f',%X%*\a[%*\d]: Leaving direct
ory %*[`']%f',%D%*\a: Entering directory %*[`']%f',%X%*\a: Leav
ing directory %*[`']%f',%DMaking %*\a in %f,%f|%l| %m
...and by changing the output of the build process from
make: Entering directory `<directory>`
to
make: Entering `<directory>`
i got it to work by extending errorformat like this:
:set errorformat+=%D%*\\a:\ Entering\ %*[`']%f'

add a permitted path to ghostscipt running configuration

I use a program which create me postscript file before using ps2pdf to make it a readable pdf, i've made a program which add some string to overwrite the company new logo. (The first program can't import image file itself).
I add the string before the before-last line of the file (" showpage").
While running my program to add the logo there is no error.
With the option -dNOSAFER everything is fine, but by default it's set to -dSAFER, and an invalidfileaccess error pop, the files are 6 jpg images alone in their directory.
I don't want to make it run with the -dNOSAFER option on. As it will fully open the file system.
In the documentation I've seen that there is a "permitted path" setting, but i can't find nowhere to set this up. Is it just a command line option to set in the command launching the program ? Or is there a config file for GhostScript / ps2pdf where i can put the path to this directory as permitted path.
in this documentation :
http://www.ghostscript.com/doc/current/Use.htm
I only find
-dTTYPAUSE
Causes Ghostscript to read a character from /dev/tty, rather than
standard input, at the end of each page. This may be useful if input
is coming from a pipe. Note that -dTTYPAUSE overrides -dNOPAUSE. Also
note that -dTTYPAUSE requires opening the terminal device directly,
and may cause problems in combination with -dSAFER. Permission errors
can be avoided by adding the device to the permitted reading list
before invoking safer mode
gs -dTTYPAUSE -dDELAYSAFER -c '<< /PermitFileReading [ (/dev/tty)] >> setuserparams .locksafe' -dSAFER
The quote is just for the context but is this a way to put the permitted path ?
As gs automatically launch with the full system as readOnly there will be no difference ? There is no other find result for PermitFile in this page.
Try adding the required path to the search path with -I (Include) See Use.htm, section 8 How Ghostscript finds files. This should only be a problem if you are using 'run' or similar to read files from another location.
The section on TTYPAUSE is not relevant.

Renaming files like 20141207_190822.jpg to "2014-12-07 19.08.22.jpg" in linux or MacOS X

How in Linux or MacOS X to rename a bunch of files with names 20141207_190822.jpg and 20141207_190823.mp4 to this format:
2014-12-07 19.08.22.jpg
and
2014-12-07 19.08.23.mp4
?
I've found many examples how to just add something to the beginning of filename, but here I need to change the mask by inserting symbols in the middle of filenames and replacing _ with space " ".
Thank you
Try doing this :
$ rename 's#^(\d{4})(\d{2})(\d{2})_(\d{2})(\d{2})(\d{2})#$1-$2-$3 $4.$5.$6#' *
There are other tools with the same name which may or may not be able to do this, so be careful.
If you run the following command :
$ file $(readlink -f $(type -p rename))
and you have a result like
.../rename: Perl script, ASCII text executable
then this seems to be the right tool =)
If you don't have this command, search your package manager to install it or do it manually
Last but not least, this tool was originally written by Larry Wall, the Perl's dad.

Resources