An XCode project on OSX 10.6 fails building due to exit code 3 when trying to run Rez. What does this mean? I'm sure the files exist and all paths are set correctly, and have valid content. Google and AltaVista turn up nothing but others with the same question.
More generally, since I have a talent for creating errors on OSX, is there a list of all possible exit codes for Rez and what they mean? Are these standard among all of Apples command line programs?
UPDATE:
Here's the first .r file that Rez tries to compile, but stops with exit code 3:
// The About box and resources are created in PIUtilities.r.
// You can easily override them, if you like.
#define plugInName "HackFormat"
#define plugInCopyrightYear "1957"
#define plugInDescription \
"Hackup of sample plugin SimpleFormat to test plugin making procedures (DSW)"
// Dictionary (aete) resources:
#define vendorName "DarenTheMonkey"
#define plugInAETEComment "simpleformat example file format module"
#define plugInSuiteID 'sdK4'
#define plugInClassID 'simP'
#define plugInEventID typeNull // must be this
#include "PIDefines.h"
#include "Types.r"
#include "SysTypes.r"
#include "PIGeneral.r"
#include "PIUtilities.r"
#include "PITerminology.h"
#include "PIActions.h"
#include "HackFormatTerminology.h" // Terminology for plug-in.
//-------------------------------------------------------------------------------
// PiPL resource
//-------------------------------------------------------------------------------
resource 'PiPL' (ResourceID, plugInName " PiPL", purgeable)
{
{
Kind { ImageFormat },
Name { plugInName },
Version { (latestFormatVersion ", /* must be exactly this */
keyInherits, /* must be keyInherits */
classFormat, /* parent: Format, Import, Export */
"parent class format", /* optional description */
flagsSingleProperty, /* if properties, list below */
"foo",
keyMyFoo,
typeBoolean,
"foobar",
flagsSingleProperty,
"bar",
keyMyBar,
typeBoolean,
"foobar",
flagsSingleProperty
/* no properties */
},
{}, /* elements (not supported) */
/* class descriptions */
},
{}, /* comparison ops (not supported) */
{} /* any enumerations */
}
};
resource StringResource (kHistoryEntry, "History", purgeable)
{
plugInName ": ref num=^0."
};
// end file
and, from the xcode Build Results window, (just for this first .r file; rest are same)
Build HackFormat of project hackformat with configuration Debug
Check dependencies
[WARN]Warning: The Copy Bundle Resources build phase contains this target's Info.plist file 'Info.plist'.
Rez tmp/hackformat.build/Debug/HackFormat.build/ResourceManagerResources/Objects/HackFormat-A69F02213383561.rsrc HackFormat.r
cd /home/dwilson/proj/PSPlug/hackformat
/Developer/Tools/Rez -o /home/dwilson/proj/PSPlug/hackformat/tmp/hackformat.build/Debug/HackFormat.build/ResourceManagerResources/Objects/HackFormat-A69F02213383561.rsrc -d SystemSevenOrLater=1 -useDF -script Roman -arch x86_64 -i /home/dwilson/proj/PSPlug/hackformat/Debug -i /home/dwilson/proj/PSPlug/hackformat/sampcomm -i sampcomm -i /home/dwilson/proj/PSPlug/hackformat -i /home/dwilson/proj/PSPlug/hackformat/sampcomm -i /home/dwilson/SW/SDK/AdobePS/adobe_photoshop_cs5_sdk_mac/photoshopapi/photoshop -i /home/dwilson/SW/SDK/AdobePS/adobe_photoshop_cs5_sdk_mac/photoshopapi/pica_sp -i /Developer/Headers/FlatCarbon -i /home/dwilson/SW/SDK/AdobePS/adobe_photoshop_cs5_sdk_mac/photoshopapi/resources -i /home/dwilson/proj/PSPlug/hackformat/Debug -i /home/dwilson/proj/PSPlug/hackformat/Debug/include -i sampcomm /home/dwilson/proj/PSPlug/hackformat/../../../common/includes/MachOMacrezXcode.h -isysroot /Developer/SDKs/MacOSX10.5.sdk /home/dwilson/proj/PSPlug/hackformat/HackFormat.r
### /Developer/Tools/Rez - SysError 0 during open of "/home/dwilson/proj/PSPlug/hackformat/../../../common/includes/MachOMacrezXcode.h".
Fatal Error!
### /Developer/Tools/Rez - Fatal Error, can't recover.
/home/dwilson/proj/PSPlug/hackformat/../../../common/includes/MachOMacrezXcode.h: ### /Developer/Tools/Rez - Since errors occurred, /home/dwilson/proj/PSPlug/hackformat/tmp/hackformat.build/Debug/HackFormat.build/ResourceManagerResources/Objects/HackFormat-A69F02213383561.rsrc's resource fork was not written.
Command /Developer/Tools/Rez failed with exit code 3
From the Rez man page:
Rez can return the following status codes:
0 no errors
1 error in parameters
2 syntax error in resource description file
3 I/O or program error
man I'm just tagging along on this. I get Command /Developer/usr/bin/Rez failed with exit code 3
I've been looking everywhere for a comprehensive list of exit codes without any luck. Or at least any information on exit code 3.
Update: I just found this in here http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/codesign.1.html (I'm not sure if this applies in any way to xcode as it seems to be part of the darwin documentation and I know very little about it):
codesign exits 0 if all operations succeed. This indicates that all codes were signed, or all codes
verified properly as requested. If a signing or verification operation fails, the exit code is 1. Exit
code 2 indicates invalid arguments or parameters.
Exit code 3 indicates that during verification, all
path(s) were properly signed but at least one of them failed to satisfy the requirement specified with
the -R option.
For verification, all path arguments are always investigated before the program exits. For all other
operations, the program exits upon the first error encountered, and any further path arguments are
ignored, unless the --continue option was specified, in which case codesign will defer the failure exit
until after it has attempted to process all path arguments in turn.
Again I'm not sure but seems to be a permissions problem. Will investigate further!
I have found the problem! In Project Setting, there was a bad path in Rez Prefix File. It's supposed to be a path to a file MachOMacrezXcode.h. Now it is obvious that this file wasn't being found when I look at the Build Results. I have copied this file into my project source (since I want no dependencies on the original sample code I'm taking source from) and fixed the path.
Related
While browsing the Firefox source code, I see that a lot of logs are present. I'd like to find them on runtime to help me understand and debug something.
For example, when taking a look at nsHttpConnection.cpp, Here's what I can find :
...
LOG(("restarting transaction #%p\n", this));
mTunnelProvider = nullptr;
...
Where did the LOG lines go ? How do I find the log file containing all the logs generated by Firefox ?
In the case of the file nsHttpConnection.cpp, the LOG() functions are macros defined in HttpLog.h.
here's an excerpt :
#define LOG1(args) \
MOZ_LOG(mozilla::net::gHttpLog, mozilla::LogLevel::Error, args)
You can see them as shortcuts for the more complete MOZ_LOG functions.
LOG1() -> Error
LOG2() -> Warning
LOG3() -> Info
LOG() = LOG4() -> Debug
LOG5() -> Verbose
If you want to get the logs for the nsHttp module, you can set 2 environment variables, and then run firefox :
set MOZ_LOG=nsHttp:5
set MOZ_LOG_FILE=http.log
firefox
or run firefox with the command line parameters :
firefox -MOZ_LOG=nsHttp:5 -MOZ_LOG_FILE=nsHttp.log
This enables Verbose level information (and higher) and places all output in the file nsHttp.log.
The MOZ_LOG variable is composed of as <module>:level.
You can also use a more general module all to include them all.
i.e. to log all Error level informations in the file all.log:
firefox -MOZ_LOG=all:1 -MOZ_LOG_FILE=all.log
For more information on how the MOZ_LOG variable is configured, you can take a look at prlog.h
I'm trying to use gpg to --clearsign a file (for debian packaging purposes) from a script.
I have an exported password-less private-key.gpg file and want to:
gpg --clearsign -o output input
I don't want to mess with the current user's ~/.gnupg or /run/user/$(id -u)/gnupg because they have nothing to do with my script. Also, the script could be running in multiple instances simultaneously and I don't want them interfering with one another.
I thought that would be easy. Setup $GNUPGHOME to a temp dir and be done with it. But I cannot figure out how to get gpg to run in a script without messing with the user's standard configuration at all. It seems gpg has gone to great lengths to make it impossible to avoid the gpg-agent and gpg-agent insists on using global/hard-coded paths.
Can I keep everything under $GNUPGHOME? Or how do I safely use gpg from a shell script without influencing the user's config or use of gpg or other instances of my script?
Details
Reading the gpg docs I see that:
--use-agent
--no-use-agent
This is dummy option. gpg always requires the agent.
And gpg-agent docs say:
--use-standard-socket
--no-use-standard-socket
--use-standard-socket-p
Since GnuPG 2.1 the standard socket is always used.
These options have no more effect. The command gpg-agent
--use-standard-socket-p will thus always return success.
This "standard socket" is presumably in /run/user/$(id -u)/gnupg - so it seems I can't avoid gpg messing with the user's "normal" use of gpg.
Versions: gpg 2.1.18 on Debian 9 / stretch / stable
If you can't stop gpg from creating files, would it help to give gpg a place to put them that's unique to the current process?
# Create a temporary directory for gpg.
dir="$(mktemp -d)"
# Remove the directory and its contents when the script exits.
trap '[[ ! -d "${dir}" ]] || rm -r "${dir}"' EXIT
# Put your private-key.gpg in the temporary directory.
$(your command here)
# Tell gpg to use the temporary directory.
gpg --homedir "${dir}" --clearsign -o output input
After multiple hours of searching the internet for some option to enable running multiple instances of gpg-agent with different gnupg homes I tried just restricting the access to the global socket location and it worked. It fell back to placing the socket files in the gnupg home directory. I used bwrap to do that. Here's the full command that worked: bwrap --dev-bind / / --tmpfs /run/user/$(id -u)/gnupg gpg-agent .... Since your question is about scripts in general, you probably can't rely on bwrap being installed, so the next best thing is a shim that prevents gpg-agent from using the user's xdg runtime directory for its sockets.
After looking through the output of strace, the switch of location when running under bwrap to gnupg home seems to happen after a stat on /run/user/${UID}/gnupg is issued. Looking through the gpg-agent.c code this seems to do that check:
/* Check that it is a directory, owned by the user, and only the
* user has permissions to use it. */
if (!S_ISDIR(sb.st_mode)
|| sb.st_uid != getuid ()
|| (sb.st_mode & (S_IRWXG|S_IRWXO)))
{
*r_info |= 4; /* Bad permissions or not a directory. */
if (!skip_checks)
goto leave;
}
Using this we can just tell gpg-agent that the /run/user/${UID}/gnupg exists, but is not a directory, so it will fail the first of these checks.
Here's the code for a shim that does just that (could be better, but it works):
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <dlfcn.h>
#include <stdio.h>
#define STR_MAX 4096
#define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b)
// Set up checking stuff
#define MAX_UID_LEN 11
#define PREFIX_1 "/run/user"
#define PREFIX_2 "/var/run/user"
#define TEST_LEN_1 (sizeof(PREFIX_1) - 1 + 1 + MAX_UID_LEN + sizeof("/gnupg") - 1)
#define TEST_LEN_2 (sizeof(PREFIX_2) - 1 + 1 + MAX_UID_LEN + sizeof("/gnupg") - 1)
#define MAX_TEST_LEN MAX(TEST_LEN_1, TEST_LEN_2)
// Override stat function
int stat(const char *restrict pathname, struct stat *restrict statbuf) {
int (*original_stat)(const char *restrict, struct stat *restrict) = dlsym(RTLD_NEXT, "stat");
// Call original stat function
int retval = original_stat(pathname, statbuf);
if (retval == 0) {
// Check if a path we want to modify
size_t pathlen = strnlen(pathname, STR_MAX);
char path_check[MAX_TEST_LEN + 1];
snprintf(path_check, MAX_TEST_LEN + 1, "%s/%u/gnupg", PREFIX_1, getuid());
if (strncmp(pathname, path_check, MIN(MAX_TEST_LEN, pathlen)) == 0) {
// Report a regular file with perms: rwxrwxrwx
statbuf->st_mode = S_IFREG|0777;
}
snprintf(path_check, MAX_TEST_LEN + 1, "%s/%u/gnupg", PREFIX_2, getuid());
if (strncmp(pathname, path_check, MIN(MAX_TEST_LEN, pathlen)) == 0) {
// Report a regular file with perms: rwxrwxrwx
statbuf->st_mode = S_IFREG|0777;
}
}
return retval;
}
You can compile it with: clang -Wall -O2 -fpic -shared -ldl -o gpg-shim.so gpg-shim.c and then add it to LD_PRELOAD and it should then allow you to run multiple gpg-agents as long as they have different gnupg homes.
I know this answer is really late, but I hope it can help some people that were, like me, looking for a way to run multiple gpg-agents with different homedirs. (For my specific case, I wanted to run multiple gpg-agent instances to have keys cached different amounts of time).
I am installing cl-jupyter, there is a problem in quicklisp like this:
$ sbcl --load ./cl-jupyter.lispThis is SBCL 1.3.1.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
... initialization mode... please wait...
To load "cl-jupyter":
Load 1 ASDF system:
cl-jupyter
; Loading "cl-jupyter"
.........; cc -o /home/keys/.cache/common-lisp/sbcl-1.3.1.debian-linux-x64/home/keys/quicklisp/dists/quicklisp/software/pzmq-20170403-git/grovel__grovel-tmpGHU3ALSV.o -c -m64 -fPIC -I/home/keys/quicklisp/dists/quicklisp/software/cffi_0.19.0/ /home/keys/.cache/common-lisp/sbcl-1.3.1.debian-linux-x64/home/keys/quicklisp/dists/quicklisp/software/pzmq-20170403-git/grovel__grovel.c
/home/keys/.cache/common-lisp/sbcl-1.3.1.debian-linux-x64/home/keys/quicklisp/dists/quicklisp/software/pzmq-20170403-git/grovel__grovel.c:6:17: fatal error: zmq.h: file not found
compilation terminated.
While evaluating the form starting at line 5, column 0
of #P"/home/keys/cl-jupyter/./cl-jupyter.lisp":
debugger invoked on a CFFI-GROVEL:GROVEL-ERROR in thread #<THREAD "main thread" RUNNING {100399C6A3}>: Subprocess (:PROCESS #<SB-IMPL::PROCESS :EXITED 1>)
with command ("cc" "-o" "/home/keys/.cache/common-lisp/sbcl-1.3.1.debian-linux-x64/home/keys/quicklisp/dists/quicklisp/software/pzmq-20170403-git/grovel__grovel-tmpGHU3ALSV.o" "-c" "-m64" "-fPIC" "-I/home/keys/quicklisp/dists/quicklisp/software/cffi_0.19.0/" "/home/keys/.cache/common-lisp/sbcl-1.3.1.debian-linux-x64/home/keys/quicklisp/dists/quicklisp/software/pzmq-20170403-git/grovel__grovel.c")
exited with error code 1
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [RETRY ] Retry PROCESS-OP on #<GROVEL-FILE "pzmq" "grovel">.
1: [ACCEPT ] Continue, treating PROCESS-OP on #<GROVEL-FILE "pzmq" "grovel"> as having been successful.
2: Retry ASDF operation.
3: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the configuration.
4: [ABORT ] Give up on "cl-jupyter"
5: [RETRY ] Retry EVAL of current toplevel form.
6: [CONTINUE ] Ignore error and continue loading file "/home/keys/cl-jupyter/./cl-jupyter.lisp".
7: Abort loading file "/home/keys/cl-jupyter/./cl-jupyter.lisp".
8: Ignore runtime option --load "./cl-jupyter.lisp".
9: Skip rest of --eval and --load options.
10: Skip to toplevel READ/EVAL/PRINT loop.
11: [EXIT ] Exit SBCL (calling #'EXIT, killing the process).
(CFFI-GROVEL:GROVEL-ERROR "~a" #<UIOP/RUN-PROGRAM:SUBPROCESS-ERROR {100691C9F3}>)
As you can see,it says "quicklisp/dists/quicklisp/software/pzmq-20170403-git/grovel__grovel.c" can not be found.
so I am trying to find if there is a .c file in the original quicklisp package,but actually not.Why this problem happened,and hoe do I fix it?
zmq.h is the file that can't be found. You have to install a library that provides that header file for the Lisp side to compile properly.
After running a set of tests with drmemory overnight I am trying to resolve the error stacks by providing pdb symbols. The pdb's come from a large samba-mapped repository and using _NT_SYMBOL_PATH at runtime slowed things down too much.
Does anyone know of a tool that post-processes results.txt and pulls new symbols (via NT_SYMBOL_PATH or otherwise) as required to produce more detailed stacks ? If not, any hints for adapting asan_symbolize.py to do this ?
https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/asan/scripts/asan_symbolize.py
What I came up with so far using dbghelp.dll is below. Works but could be better.
https://github.com/patraulea/postpdb
ok this Query does not pertain to use of windbg or doesn't have anything to do with _NT_SYMBOL_PATH
Dr.Memory is a memory diagnostic tool akin to valgrind and is based on Dynamorio instumentation framework usable on raw unmodified binaries
on windows you can invoke it like drmemory.exe calc.exe from a command prompt (cmd.exe)
as soon as the binary finishes execution a log file named results.txt is written to a default location
if you had setup _NT_SYMBOL_PATH drmemory honors it and resolves symbol information from prepulled symbol file (viz *.pdb) it does not seem to download files from ms symbol server it simply seems to ignore the SRV* cache and seems to use only the downstream symbol folder
so if the pdb file is missing or isnt downloaded yet
the results.txt will contain stack trace like
# 6 USER32.dll!gapfnScSendMessage +0x1ce (0x75fdc4e7 <USER32.dll+0x1c4e7>)
# 7 USER32.dll!gapfnScSendMessage +0x2ce (0x75fdc5e7 <USER32.dll+0x1c5e7>)
while if the symbol file was available it would show
# 6 USER32.dll!InternalCallWinProc
# 7 USER32.dll!UserCallWinProcCheckWow
so basically you need the symbol file for appplication in question
so as i commented you need to fetch the symbols for the exe in question
you can use symchk on a running process too and create a manifest file
and you can use symchk on a machine that is connected to internet
to download symbols and copy it to a local folder on a non_internet machine
and point _NT_SYMBOL_PATH to this folder
>tlist | grep calc.exe
1772 calc.exe Calculator
>symchk /om calcsyms.txt /ip 1772
SYMCHK: GdiPlus.dll FAILED - MicrosoftWindowsGdiPlus-
1.1.7601.17514-gdiplus.pdb mismatched or not found
SYMCHK: FAILED files = 1
SYMCHK: PASSED + IGNORED files = 27
>head -n 4 calcsyms.txt
calc.pdb,971D2945E998438C847643A9DB39C88E2,1
calc.exe,4ce7979dc0000,1
ntdll.pdb,120028FA453F4CD5A6A404EC37396A582,1
ntdll.dll,4ce7b96e13c000,1
>tail -n 4 calcsyms.txt
CLBCatQ.pdb,00A720C79BAC402295B6EBDC147257182,1
clbcatq.dll,4a5bd9b183000,1
oleacc.pdb,67620D076A2E43C5A18ECD5AF77AADBE2,1
oleacc.dll,4a5bdac83c000,1
so assuming you have fetched the symbols it would be easier to rerun the tests with a locally cached copies of the symbol files
if you have fetched the symbols but you cannot rerun the tests and have to work solely with the output from results.txt you have some text processing work (sed . grep , awk . or custom parser)
the drmemory suite comes with a symbolquery.exe in the bin folder and it can be used to resolve the symbols from results.txt
in the example above you can notice the offset relative to modulebase like
0x1c4e7 in the line # 6 USER32.dll!gapfnScSendMessage +0x1ce (0x75fdc4e7 {USER32.dll+0x1c4e7})
so for each line in results.txt you have to parse out the offset and invoke symbolquery on the module like below
:\>symquery.exe -f -e c:\Windows\System32\user32.dll -a +0x1c4e7
InternalCallWinProc+0x23
??:0
:\>symquery.exe -f -e c:\Windows\System32\user32.dll -a +0x1c5e7
UserCallWinProcCheckWow+0xb3
a simple test processing example from a result.txt and a trimmed output
:\>grep "^#" results.txt | sed s/".*<"//g
# 0 system call NtUserBuildPropList parameter #2
USER32.dll+0x649d9>)
snip
COMCTL32.dll+0x2f443>)
notice the comctl32.dll (there is a default comctl.dll in system32.dll and several others in winsxs you have to consult the other files like global.log to view the dll load path
symquery.exe -f -e c:\Windows\winsxs\x86_microsoft.windows.common-
controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2\comctl32.dll -a +0x2f443
CallOriginalWndProc+0x1a
??:0
symquery.exe -f -e c:\Windows\system32\comctl32.dll -a +0x2f443
DrawInsert+0x120 <----- wrong symbol due to wrong module (late binding
/forwarded xxx yyy reasons)
I am trying to install gcc-2.7.2 after reading the requirements for installing Festival here. On my workstation, I have gcc 4.4.1 installed. I am running into problems while running make. Here is how I am running make:
make |& tee make.log
The error message is as follows:
decl.c: In function ‘push_class_level_binding’:
decl.c:3606: error: lvalue required as increment operand
The offending line from decl.c is: obstack_ptr_grow (&decl_obstack, x);
The above function returns void. A look at the function definition in the file obstack.h shows:
#define obstack_ptr_grow(OBSTACK,datum) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
if (__o->next_free + sizeof (void *) > __o->chunk_limit) \
_obstack_newchunk (__o, sizeof (void *)); \
if (!__o->alloc_failed) \
*((void **)__o->next_free)++ = ((void *)datum); \
(void) 0; })
There is only one increment operation happening here. I am not sure how to change it to make the error go away. Or am I looking in the wrong place?
Any help is most welcome.
P.S: Please let me know in case more information is needed.
If the Festival folks suggest 2.7.2, their project would be completely abandoned for some reason. In fact, the festival folks themselves say they support gcc 4.5. So, if you experience problems like in the other post, go ahead and report them in the upstream.