It made the code look a little messy, is easily resolved in the build
system and made the dependencies more complicated than needed. Each
GParted header was tracked via multiple different names (different
numbers of "../include/" prefixes). For example just looking at how
DialogFeatures.o depends on Utils.h:
$ cd src
$ make DialogFeatures.o
$ egrep ' [^ ]*Utils.h' .deps/DialogFeatures.Po
../include/DialogFeatures.h ../include/../include/Utils.h \
../include/../include/../include/../include/../include/../include/Utils.h \
../include/../include/../include/Utils.h \
After removing "../include/" from the GParted header #includes, just
need to add "-I../include" to the compile command via the AM_CPPFLAGS in
src/Makefile.am. Now the dependencies on GParted header files are
tracked under a single name (with a single "../include/" prefix). Now
DialogFeatures.o only depends on a single name to Utils.h:
$ make DialogFeatures.o
$ egrep ' [^ ]*Utils.h' .deps/DialogFeatures.Po
../include/DialogFeatures.h ../include/Utils.h ../include/i18n.h \
realpath(3) manual page says:
BUGS
The POSIX.1-2001 standard version of this function is broken by
design, since it is impossible to determine a suitable size for
the output buffer, resolved_path. According to POSIX.1-2001 a
buffer of size PATH_MAX suffices, but PATH_MAX need not be a
defined constant, and may have to be obtained using pathconf(3).
And asking pathconf(3) does not really help, since, on the one
hand POSIX warns that the result of pathconf(3) may be huge and
unsuitable for mallocing memory, and on the other hand
pathconf(3) may return -1 to signify that PATH_MAX is not
bounded. The resolved_path == NULL feature, not standardized in
POSIX.1-2001, but standardized in POSIX.1-2008, allows this
design problem to be avoided.
The resolved_path == NULL feature of realpath() has existed as a Glibc
extension since realpath() was first added to Glibc 1.90, released in
June 1996. Therefore it can be used unconditionally.
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=fa0bc87c32d02cd81ec4d0ae00e0d943c683e6e1
Bug 764369 - Use realpath() safely
Renamed from DEV_MAP_PATH to DEV_MAPPER_PATH. Moved so that the
constant is logically intended for use outside of the DMRaid class.
Also specifically make the string constant have external linkage, rather
than the default internal (static) linkage for constants, so that there
is only one copy of the variable in the program, rather than one copy in
each compilation unit which included DMRaid.h. Namely DMRaid.cc and
GParted_Core.cc.
References:
[1] Proper way to do const std::string in a header file?
http://stackoverflow.com/questions/10201880/proper-way-to-do-const-stdstring-in-a-header-file
[2] What is external linkage and internal linkage in C++
http://stackoverflow.com/questions/1358400/what-is-external-linkage-and-internal-linkage-in-c/1358796#1358796
Bug 760080 - Implement read-only LUKS support
Lots of files which use the Partition class relied on the declaration
being included via other header files. This is bad practice.
Add #include "Partition.h" into every file which uses the Partition
class which doesn't already include it. Header file #include guards are
specifically to allow this.
This is part of parent bug:
Bug #721455 - Obsolete info in license text on multiple modules
and GNOME Goal:
https://wiki.gnome.org/Initiatives/GnomeGoals/Proposals
* verify all source files to make sure they have a license and a
copyright, and that both are up-to-date
Bug #721565 - License text contains obsolete FSF postal address
Add code to handle situation where realpath might return a NULL value.
Prior to this change the compiler would complain with the following
message:
error: ignoring return value of ‘char* realpath(const char*, char*)’,
declared with attribute warn_unused_result
Usage of the kpartx package to create partition names has been
completely removed. Hence kpartx is no longer even an optionally used
package by gparted.
This change is related to the following bug report:
Ubuntu launchpad bug 719129 - [Natty] Gparted duplicates dmraid
partition devices
https://bugs.launchpad.net/ubuntu/+source/gparted/+bug/719129
Newer versions (dmraid-1.0.0-rc16?) of dmraid default to always
creating partition names by inserting the letter 'p' between the
device name and the partition number. Since this is not
consistent with older versions of dmraid, add extra logic to
ensure that newer versions of dmraid do not insert this extra
letter 'p'.
Rename method get_udev_name to get_udev_dm_name and enhance to
retrieve the property DM_NAME.
Handle situation where parted, and hence libparted, has been
configured with --disable-device-mapper. In this situation on
some distros the device name could be /dev/dm-0. This results in
invalid partition names such as /dev/dm-0p1. Add logic to decode
the actual /dev/mapper name.
With this patch the commands required to support motherboard BIOS
RAID, also known as fake RAID, are dmraid and dmsetup.
If the kpartx command is available, it will be used to maintain
device entries that follow the naming convention used by kpartx.
Closes Ubuntu launchpad bug 554582 - GParted does not list dmraid
devices
https://bugs.launchpad.net/ubuntu/+source/gparted/+bug/554582
It appears that different dmraid versions handle specifying a
single dmraid device differently.
dmraid-1.0.0.rc14 uses a partial name only,
such as "isw" or "isw_cjbdddajhi".
dmriad-1.0.0.rc15 uses a full name only,
such as "isw_cjbdddajhi_Vol0".
To maintain compatibility with the broadest range of dmraid versions,
the ability to specify a single dmraid device is being removed.
Some distros appear to display /dev/dm-# device names with
libparted. Since this fails a pattern match with the dmraid
device name, check with udev to see if a pattern match is
possible with the name returned from udevinfo or udevadm info.
For example:
/dev/mapper/isw_cjbdddajhi_Vol0 is the device name
/dev/dm-0 is a symbolic link pointing to the above device name