1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-03-27 07:23:31 +01:00

3 Commits

Author SHA1 Message Date
Carlos R. Mafra
93b049356f Revert "WUtil: Be more strict about base directory for wmkdirhier()"
This reverts commit a0b283a60f,
as it breaks saving the history in ~GNUstep/.AppInfo/WindowMaker/History
by restricting modifications to either ~GNUstep/Defaults or ~GNUstep/Library.

Thanks to Paul Selig for reporting this issue.
2023-08-21 22:22:32 +01:00
Carlos R. Mafra
75f353bef4 Update .gitignore
Since

fc63d72032 (WINGs: Fix incorrect use of macro USE_PANGO in installed header)

and

0e274dc979 (WRaster: Fix incorrect use of macro USE_XSHM in installed header)

the files wrlib/wraster.h and WINGs/WINGs/WINGsP.h are generated by the compilation,
so add them to .gitignore
2023-08-21 21:35:30 +01:00
Christophe CURIS
2264ed9de6 Fix calculation of version number in the library mapfiles
As reported by Andreas Metzler, the latest API change in lib WRaster caused
a compatibility issue because the internal version number was increased.

To correctly handle this situation, this patch does 2 things:
 - do not discard the 2 last number in the "c:r:a" version, because we need them;
 - when calculating the version for the mapfile, use the formula that is
suggested in libtool's documentation.

The purpose of the formula is that when API is changed, if a new function
is added then the version is not incremented to reflect that we are still
compatible with current binaries, it will be incremented only when there
is a break in compatibility.
2023-08-12 21:53:52 +01:00
3 changed files with 23 additions and 26 deletions

2
.gitignore vendored
View File

@@ -30,6 +30,8 @@ m4/ltversion.m4
m4/lt~obsolete.m4
src/wconfig.h
WINGs/WINGs/WINGsP.h
wrlib/wraster.h
# These files are generated by scripts
INSTALL-WMAKER

View File

@@ -1732,36 +1732,23 @@ Bool WMWritePropListToFile(WMPropList * plist, const char *path)
* file, and the last component is stripped off. the rest is the
* the hierarchy to be created.
*
* refuses to create anything outside $WMAKER_USER_ROOT/Defaults or $WMAKER_USER_ROOT/Library
* refuses to create anything outside $WMAKER_USER_ROOT
*
* returns 1 on success, 0 on failure
*/
int wmkdirhier(const char *path)
{
const char *libpath;
char *udefpath;
int cmp;
const char *t;
char *thePath = NULL, buf[1024];
size_t p, plen;
struct stat st;
/* Only create directories under $WMAKER_USER_ROOT/Defaults or $WMAKER_USER_ROOT/Library */
libpath = wuserdatapath();
if (strncmp(path, libpath, strlen(libpath)) == 0)
if (path[strlen(libpath)] == '/')
goto path_in_valid_tree;
/* Only create directories under $WMAKER_USER_ROOT */
if ((t = wusergnusteppath()) == NULL)
return 0;
if (strncmp(path, t, strlen(t)) != 0)
return 0;
udefpath = wdefaultspathfordomain("");
cmp = strncmp(path, udefpath, strlen(udefpath));
wfree(udefpath);
if (cmp == 0)
/* Note: by side effect, 'udefpath' already contains a final '/' */
goto path_in_valid_tree;
/* If we reach this point, the path is outside the allowed tree */
return 0;
path_in_valid_tree:
thePath = wstrdup(path);
/* Strip the trailing component if it is a file */
p = strlen(thePath);
@@ -1784,6 +1771,7 @@ int wmkdirhier(const char *path)
}
memset(buf, 0, sizeof(buf));
strncpy(buf, t, sizeof(buf) - 1);
p = strlen(buf);
plen = strlen(thePath);
@@ -1794,7 +1782,7 @@ int wmkdirhier(const char *path)
strncpy(buf, thePath, p);
if (mkdir(buf, 0777) == -1 && errno == EEXIST &&
stat(buf, &st) == 0 && !S_ISDIR(st.st_mode)) {
werror(_("Could not create path component %s"), buf);
werror(_("Could not create component %s"), buf);
wfree(thePath);
return 0;
}

View File

@@ -77,10 +77,8 @@ while [ $# -gt 0 ]; do
-v)
shift
# Version may be 'x:y:z', we keep only 'x'
version="`echo "$1" | sed -e 's,:.*$,,' `"
# the version should only be a number
echo "$version" | grep '^[1-9][0-9]*$' > /dev/null || \
version="$1"
echo "$version" | grep -E '^[1-9][0-9]*(:[0-9]+(:[0-9]+)?)?$' > /dev/null || \
arg_error "version \"$1\" is not valid"
;;
@@ -109,9 +107,18 @@ fi
# generate the rest of the script so that other symbols will not be kept.
awk '
BEGIN {
# Version number here uses only 1 number from the full version used in libtool
libversion="'"$version"'";
if (split(libversion, subversions, ":") > 1) {
# Calculate [CURRENT - AGE], the goal is that the number will not
# change when functions are added to the API, but it will be incremented
# when functions are removed or argument change (which breaks compat)
libversion = subversions[1] - subversions[3];
}
print "/* Generated version-script for ld */";
print "";
print "'"$libname$version"'";
print "'"$libname"'" libversion;
print "{";
print " global:";
}