Jon Turney [Tue, 11 Apr 2023 15:30:09 +0000 (16:30 +0100)]
Fix reinstall via command line
Since b0bd16950669, we're unconditionally generating an initial solver
solution via changeTrust(), even if manual package selections are made
on the command line.
This will discard reinstalls, as they aren't done via the solver.
Arrange to retain them by using augmentTask() to add them back to the
solution, then teach trans2db() to convert reinstalls back into
packagedb actions.
Use off_t more consistently for file offsets and file size
- Change the seek and tell methods to off_t in the first place,
and use fseeko/ftello throughout.
- Change class members holding file sizes and offsets to off_t,
use matching casts.
- Use strtoll rather than sscanf to read octal file length
in tar archives. It's faster and typesafe.
- Use off_t as argument types for progress bar functions.
Additionally:
- Reformat io_stream_memory.h, which was next to unreadable
due to bad formatting.
io_stream::read and io_stream::write are defined as ssize_t, and most
of the callers expect -1 in case of an error.
However, io_stream_file and io_stream_cygfile both use fread/fwrite and
return their return value unchanged. Both functions return a size_t and
return 0 in both cases, EOF and error.
Fix this by checking the return value of fread and fwrite and return -1
in case of an error.
Change the two callers calling read and expecting 0 to indicate EOF and
error accordingly.
Jon Turney [Wed, 1 Feb 2023 13:33:57 +0000 (13:33 +0000)]
Handle TTN_GETDISPINFOW
As a consequence of the previous commits, we're now receiving
TTN_GETDISPINFOW rather than TTN_GETDISPINFOA, so handle that (which
makes full unicode in the tooltip possible).
Jon Turney [Wed, 1 Feb 2023 13:10:25 +0000 (13:10 +0000)]
Use SetWindowLongPtrW() when setting WndProc
Using the SetWindowLongPtrA() variant means that a Unicode to ASCII shim
is inserted around the installed WndProc, which is not what we want.
(Specfically, this flattens the PropSheet caption to an 8-bit encoding
as it passes through the WndProc as a WM_SETTEXT message, which is not
reversible for non-latin scripts)
Future work: Rewrite this using SetWindowSubclass() instead, which
sidesteps all these issues.
Jon Turney [Mon, 30 Jan 2023 23:27:10 +0000 (23:27 +0000)]
Use wide-char PropSheet API
This probably has no effect on Vista or later, where the manifest ensure
we are using common controls 6.0, which are fully unicode internally,
but it probably neccessary on XP.
Jon Turney [Fri, 8 Jul 2022 14:56:59 +0000 (15:56 +0100)]
Drop group change while running postinstall scripts
Drop group change while running postinstall scripts. This was only for
the benefit of mkgroup/mkpasswd being run by the postinstall script,
which we don't do any more.
Jon Turney [Fri, 27 Jan 2023 13:44:04 +0000 (13:44 +0000)]
Add ProgramData to the env var whitelist for running scripts
It seems that we can end up calling some Win32 API which uses that env
var to form the path for a temporary directory. If we don't set it, we
end up using a directory called '%SystemDrive%'.
(This was a problem seen with e.g. man-db's post-install scripts)
Jon Turney [Mon, 21 Nov 2022 14:57:39 +0000 (14:57 +0000)]
Drop use of std::unary_function
std::unary_function is deprecated in C++11.
visit_if() in Generic.h relies upon the callable providing an
argument_type type (which both predicate and visitor accept), so retain
that in StringConcenator, but we'd probably be better off just
open-coding visit_if(), since it's only used in the one place.
Jon Turney [Sun, 20 Nov 2022 14:28:23 +0000 (14:28 +0000)]
Fix mismatched-new-delete warning in mkwslsymlink()
Fix mismatched-new-delete warning (new in gcc 12) in mkwslsymlink(),
introduced by 93b295d6
> ../mklink2.cc: In function 'int mkwslsymlink(const char*, const char*)':
> ../mklink2.cc:194:10: error: 'void operator delete(void*)' called on pointer returned from a mismatched allocation function [-Werror=mismatched-new-delete]
> ../mklink2.cc:178:115: note: returned from 'void* operator new [](std::size_t)'
Christian Franke [Tue, 27 Sep 2022 13:41:06 +0000 (15:41 +0200)]
Ignore install requests if version is not accessible
This avoids that an empty "New" version is shown when install is
requested via "Install" from "Category" view or Ctrl+I and the
version is not accessible.
Jon Turney [Mon, 12 Sep 2022 18:43:47 +0000 (19:43 +0100)]
Link with mingwex before libntll
Link with mingwex (which gcc specs will cause us to link with anyhow)
before ntll.
Some versions of the MinGW ntdll implib contain a subset of crt
functions (erroneously, they were later moved to ntllcrt). This means
that if the linker command specifies -lntdll, an application will use
ntdll.dll for things like strnlen(), which is (a) unexpected, and (b)
causes problems, as that specific export is not provided by ntll on XP.
Jon Turney [Fri, 8 Jul 2022 14:56:59 +0000 (15:56 +0100)]
Drop group change while running postinstall scripts
Drop group change while running postinstall scripts. This was only for
the benefit of mkgroup/mkpasswd being run by the postinstall script,
which we don't do any more.
Jon Turney [Tue, 28 Jun 2022 19:36:43 +0000 (20:36 +0100)]
Handle self-destruct packages
These are sometimes useful in situations where a package is obsoleted,
but doesn't have a simple replacement.
The parser can't currently handle "libsolv-self-destruct-pkg()" (the
magic provide name which triggers this behaviour in libsolv) appearing
as a provide, because (i) brackets aren't a valid character in a package
name, and (ii) empty braces isn't permitted for a versioncriteria
following a package name.
For backwards-compatibility (to allow old versions of setup to parse a
setup.ini containing this instruction) and terseness, accept
'_self-destruct' as equivalent to that magic package name.
Jon Turney [Mon, 27 Jun 2022 18:02:38 +0000 (19:02 +0100)]
Suppress bogus free-nonheap-object warning in iniparse.cc
This warning bogusly occurs with -O0 in bison generated code. The
free() is not reachable when the pointer references a non-heap object.
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98753
iniparse.cc: In function ‘int yyparse()’:
iniparse.cc:1789:18: warning: ‘void free(void*)’ called on unallocated object ‘yyssa’ [-Wfree-nonheap-object]
iniparse.cc:1148:16: note: declared here
Jon Turney [Fri, 24 Jun 2022 12:20:32 +0000 (13:20 +0100)]
Lower autoconf requirement to 2.69
We don't actually use LIBLEX, so the change in AC_PROG_LEX() behaviour
in autoconf 2.70 isn't particularly relevant, and this let's us still
build using the x86 w/ SJLJ exceptions toolchain in Fedora 31.
Jon Turney [Fri, 17 Jun 2022 14:51:15 +0000 (15:51 +0100)]
De-clutter the mirror selection listbox
Mirrors can now appear up to three times in this list (with ftp://,
http:// and https:// protocols).
We can't just stop announcing ftp:// and http:// sites in the mirror
list, as that will lead to setup warning that those mirrors have been
dropped and may be out of date.
So instead: Process site list for an optional 4th semi-colon delimited
string, to be used for flags. Recognize and store 'noshow' flag.
Hide mirror URLs with this noshow flag from the mirror selection
listbox, unless they have been already selected in a previous run.
We will use this to hide ftp://, and http:// (where https: also exists)
URLs.
This assumes that: (i) all future mirrors will provide http:// service
and (ii) nobody has a good reason for using ftp:// instead of http://
anymore. But those seem reasonable assumptions!
Also: drop explicit copy constructor and assignment operator for
site_list_type, which just do what the default would.
Jon Turney [Thu, 16 Jun 2022 21:05:05 +0000 (22:05 +0100)]
Add French translations of option help-text
Also make some minor adjustments to help-texts for consistency:
* --no-warn-deprecated-windows should start "Don't"
* --categories doesn't need to say "entire"
* --download and --local-install no longer say "seulement"
Jon Turney [Thu, 16 Jun 2022 12:57:38 +0000 (13:57 +0100)]
Add command-line option help-text localization
Change libgetopt++ Option class to store an unsigned int message catalog
identifer for the help-text, rather than a std::string of the help-text.
ParameterUsage (the function which produces the help output) now takes a
lookup function as a parameter, which translates that message identifer
to a localized std::string.
Move existing help-text to a stringtable resource, and then wire up
ParameterUsage to use LoadString.
Jon Turney [Mon, 13 Jun 2022 13:54:50 +0000 (14:54 +0100)]
Fix '-t -P package-with-only-a-test-version'
Fix how 'install any version' operates in that case.
Also make '-t' have an effect when used with '-P' but without '-g'.
Future work: The language around '-t' perhaps needs refining, since it's
absence just lowers the priority of test packages, not prohibiting their
use (so in this particular case, package-with-only-a-test-version will
be installed, even without '-t')
Jon Turney [Wed, 9 Sep 2020 13:39:26 +0000 (14:39 +0100)]
Use a .pot translation template
Add a res.pot file, created with rc2po.
Add rule to generate a .po file containing current translations using rc2po.
Add rule to incorporate updated translations from .po file using po2rc.
Both tools are part of the python translate toolkit [1]
Jon Turney [Mon, 6 Jun 2022 16:59:33 +0000 (17:59 +0100)]
Adjustment to dialog layout for translation
To enable the english resource to be used as a template, adjust the size
of the IDD_SOURCE.IDC_SOURCE_NETINST control so it's large enough for
translated text.
Jon Turney [Thu, 10 Feb 2022 15:38:56 +0000 (15:38 +0000)]
Handle tar type flag 'K' (GNU long link extension)
Handle tar type flag'K' (GNU long link extension)
Also report unexpected filename in headers with long name extension type
Also clean up some cruft in archive_tar.cc
Currently, the only existing package which contains type flag 'K'
entries is f21-backgrounds-extras.
This also now correctly handles tar archive header linknames of exactly
100 characters (even when not preceeded by a 'K' type header), where the
linkname field is not null terminated as it should be, rather than
allowing the 'ustar\0' magic immediately following it to be interpreted
as part of the linkname.
Jon Turney [Mon, 7 Feb 2022 14:52:26 +0000 (14:52 +0000)]
Show overall progress for checking packages in package cache
Show overall progress for testing presence and validating packages in
package cache.
This gives a better sense of progress when installing many packages
which are already cached (e.g. a fresh install, but all required
packagea are already in the package cache, so this step, rather than the
download one, dominates).
Jon Turney [Thu, 27 Jan 2022 22:07:28 +0000 (22:07 +0000)]
Unconditionally fixup source package ids
In the case when a given package version appears in setup.ini first
with, then without an install: line, the source package is recreated by
packagemeta::add_version() to add the additional package source site,
but the install package is not - so it now contains a stale source
package id.
Unconditionally fixup source package ids, so that install package points
to the correct source package.
Also internalize libsolv attributes after doing fixup, the changes it
makes are visible (so this was probably never working right).
Jon Turney [Mon, 24 Jan 2022 17:07:15 +0000 (17:07 +0000)]
Don't create install package if there's no install: line
Don't erroneously create an install package if there's no install: line
for that version.
If it's for the latest version and something depends on this package,
the solver will produce a solution containing that package & version,
so we'll try to download it without having a path to fetch it from,
leading to download errors which are impossible to resolve.
Jon Turney [Sun, 19 Dec 2021 21:22:55 +0000 (21:22 +0000)]
When in unattended mode, ignore attempts to close via GUI
Perhaps this should be controlled by a separate option, but making setup
non-interactive seems like a reasonable fit with the intent of
'--quiet-mode'.
This doesn't stop the installer being killed by TerminateProcess().
Jon Turney [Fri, 7 Jan 2022 15:18:02 +0000 (15:18 +0000)]
Further fix symlinks to absolute paths made for ' --symlink-type native'
After using 'to' with NtOpenFile(), convert it back to Win322
filenamespace form before using it with CreateSymbolicLinkW(), so that
the symlink works with native tools.