Debian Codegraph @

README

raw
1 What is Libgpg-error
2 ====================
3
4 Libgpg-error is a library that defines common error values for all
5 GnuPG components. Among these are GPG, GPGSM, GPGME, GPG-Agent,
6 libgcrypt, Libksba, DirMngr, Pinentry, SmartCard Daemon and more.
7 Meanwhile Libgcrypt also sports functions commonly used by all GnuPG
8 components and which are believed to be generally useful. The main
9 components are
10
11 - Structured error codes and utility functions.
12
13 - Replacement functions for stdio stream (estream) to provide a
14 reliable set of printf features on all platforms. For convenience
15 macros are provided to make migration from stdio to estream easier
16 (ie. the prefix "es_")
17
18 - Generic Mutex implementation for all platforms using an ABI
19 independent of the underlying implementation.
20
21 - A lean gettext and iconv implementation for Windows.
22
23 - Log functions
24
25 - Option parser
26
27 - Base-64 encoder and decoder.
28
29 More components will be added over time. Most functions are prefixed
30 with "gpgrt" (GnuPG Run Time) instead of "gpg_err" to indicate the
31 long term plan to rename this library to gpgrt.
32
33 Libgpg-error is free software; you can redistribute it and/or modify
34 it under the terms of the GNU Lesser General Public License as
35 published by the Free Software Foundation; either version 2.1 of the
36 License, or (at your option) any later version. See the file
37 COPYING.LIB for copyright and warranty information. See the file
38 AUTHORS for a list of authors and important mail addresses.
39
40 However, some files (for example src/mkerrnos.awk) used in the build
41 process of the library and the manual are covered by a different
42 license. Please see the header of these files and the file COPYING
43 for copyright and warranty information on these files. A special
44 exception in the copyright license of these files makes sure that the
45 output in the build process, which is used in libgpg-error, is not
46 affected by the GPL.
47
48
49 Installation
50 ============
51
52 Please read the file INSTALL!
53
54 Here is a quick summary:
55
56 1) Check that you have unmodified sources. You can find instructions
57 how to verify the sources below. Don't skip this - it is an
58 important step!
59
60 2) Unpack the archive. With GNU tar you can do it this way:
61 "tar xjvf libgpg-error-x.y.tar.bz2"
62
63 3) "cd libgpg-error-x.y"
64
65 4) "./configure"
66
67 5) "make"
68
69 6) "make install"
70
71
72 How to Verify the Source
73 ========================
74
75 In order to check that the version of libgpg-error which you are going
76 to install is an original and unmodified copy of the original, you can
77 do it in one of the following ways:
78
79 a) If you already have a trusted version of GnuPG installed, you can
80 simply check the supplied signature:
81
82 $ gpg --verify libgpg-error-x.y.tar.bz2.sig libgpg-error-x.y.tar.bz2
83
84 This checks that the detached signature libgpg-error-x.y.tar.bz2.sig
85 is indeed a signature of libgpg-error-x.y.tar.bz2. Make sure that
86 the signature has been created by a trusted keys.
87
88 Please note that you have to use an old version of GnuPG to do all
89 this stuff. *Never* use the version which was built using the
90 library you are trying to verify!
91
92 b) If you don't have any a trusted version of GnuPG, you can attempt
93 to verify the SHA1 checksum, using a trusted version of the sha1sum
94 program:
95
96 $ sha1sum libgpg-error-x.y.tar.bz2
97
98 This should yield an output _similar_ to this:
99
100 610064e5b77700f5771c8fde2691c4365e1ca100 libgpg-error-x.y.tar.bz2
101
102 Now check that this checksum is _exactly_ the same as the one
103 published via the announcement list and probably via Usenet.
104
105
106 Hints
107 =====
108
109 To build for Windows you you may use the convenience command:
110
111 ./autogen.sh --build-w32
112
113 which runs configure with suitable options. There is also basic
114 support for building a 64 bit Windows version:
115
116 ./autogen.sh --build-w64
117
118
119 Cross-Compiling
120 ===============
121
122 Libgpg-error needs to figure out some platform specific properties.
123 These are used to build the platform specific gpg-error.h file. The
124 detection is done during build time but can't be done when
125 cross-compiling. Thus if you run into an error during building you
126 need to figure out these values. You may use these commands:
127
128 build="$(build-aux/config.guess)"
129 ./configure --prefix=TARGETDIR --host=TARGET --build=$build
130 cd src
131 make gen-posix-lock-obj
132 scp gen-posix-lock-obj TARGET:
133 ssh TARGET ./gen-posix-lock-obj >tmp.h
134 mv tmp.h "syscfg/$(awk 'NR==1 {print $2}' tmp.h)"
135
136 If you are using a VPATH build adjust accordingly. If this all works
137 for you (make sure to run the test programs on the target platform),
138 please send the generated file to the gnupg-devel mailing list so that
139 we can include it in the next release. Note that in addition to the
140 aliasing done by config.sub the src/mkheader build tool does some
141 extra aliasing to avoid having too much identical syscfg files.
142
143
144
145 Known Problems
146 ==============
147
148 WSA Error Codes on Windows
149 --------------------------
150
151 On Windows, WSA Error Codes can be provided as system error codes and
152 will be transparently converted to the corresponding gpg error codes.
153 There are two problems with this support:
154
155 * Not all error codes corresponding to WSA Error codes have a detailed
156 description when printed with gpg_strerror. Some will default to
157 "Unknown error" for pretty printing. For example, WSAEHOSTDOWN will
158 be translated to GPG_ERR_EHOSTDOWN, but there is no corresponding
159 EHOSTDOWN in Windows and thus gpg_strerror will default to "Unknown
160 error" as printed by the system's strerror function for the argument
161 WSAEHOSTDOWN. (This could be fixed by adding our own error strings
162 replacing or extending the system error strings, including their
163 translations).
164
165 * The translation to a gpg error code and back to a system error code
166 in some cases does not preserve information. For example, the error
167 code WSAEACCES translates to GPG_ERR_EACCES, which translates back
168 to EACCES.
169
170 Any WSA Error code has either the first problem or the second (but not
171 both), depending on if there is a corresponding Windows error code.
172
173
174 Static Linking on GNU systems
175 -----------------------------
176
177 Typically found in gpgv static build, static linking using GNU C
178 library results a warning message from a linker about the getpwnam
179 function with libgpg-error. This is usually no problem at all.
180
181 The warning is emitted because of gnu.warning section in GNU C
182 library. The intention of GNU C library is that, it deserves a
183 warning because getpwnam uses the Name Service Switch and it might
184 result dynamic loading with possibly incompatible library.
185
186 For older systems, it was true. Nowadays, an application does not
187 directly load dynamic module for the Name Service Switch. It is
188 usually done by nscd (name service cache daemon).
189
190 Only when nscd is disabled or not available, an application loads
191 dynamic module. Only for this corner case, the warning from linker is
192 relevant. It is usually not the case on modern systems.
193
194 See T8066 for further discussion.