Dear Maintainer,
A possible fix should be [1], however the package is severely outdated
(v1.3.6 comes from 2015...).
Please package newer version (I'm attaching the output of `git diff HEAD`
between 1.3.6 and 1.4.2 as a possible starting point; I've also skipped
git from B-D for getting VERSION from d/rules).
With those changes I was able to build pacparser is a sid chroot
environment but I haven't tested pacparser functionality.
Kind Regards
[1] https://github.com/manugarg/pacparser/commit/36010edefaf87a82a389c
diff --git a/debian/compat b/debian/compat
deleted file mode 100644
index 7f8f011..0000000
--- a/debian/compat
+++ /dev/null
@@ -1 +0,0 @@
-7
diff --git a/debian/control b/debian/control
index 6a8a280..b5551d8 100644
--- a/debian/control
+++ b/debian/control
@@ -1,10 +1,14 @@
Source: pacparser
Section: libs
-Priority: extra
+Priority: optional
Maintainer: Manu Garg <manug...@gmail.com>
Uploaders: Andrew Pollock <apoll...@debian.org>
-Build-Depends: debhelper (>= 5), python3-all-dev, dh-python
-Standards-Version: 3.9.6
+Build-Depends: debhelper-compat (= 13),
+ dh-sequence-python3,
+ python3-all-dev
+Rules-Requires-Root: no
+Standards-Version: 4.6.2
+Homepage: https://github.com/manugarg/pacparser
Package: libpacparser1
Section: libs
diff --git a/debian/docs b/debian/docs
index e0d7d67..9df535e 100644
--- a/debian/docs
+++ b/debian/docs
@@ -1,2 +1,2 @@
README.md
-README.win32
+#README.win32
diff --git a/debian/patches/0001-Fix-possible-memory-overwrite-vulnerability.-134.patch b/debian/patches/0001-Fix-possible-memory-overwrite-vulnerability.-134.patch
deleted file mode 100644
index e64cd6a..0000000
--- a/debian/patches/0001-Fix-possible-memory-overwrite-vulnerability.-134.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 91a93b40f6b4e0a1a9ac497edfbc2a4b18196483 Mon Sep 17 00:00:00 2001
-From: Manu Garg <manug...@gmail.com>
-Date: Wed, 13 Apr 2022 14:30:07 -0700
-Subject: Fix possible memory overwrite vulnerability. (#134)
-
----
- src/pacparser.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/src/pacparser.c b/src/pacparser.c
-index cc70a64..5a37d09 100644
---- a/src/pacparser.c
-+++ b/src/pacparser.c
-@@ -440,11 +440,11 @@ pacparser_find_proxy(const char *url, const char *host)
- // Hostname shouldn't have single quotes in them
- if (strchr(host, '\'')) {
- print_error("%s %s\n", error_prefix,
-- "Invalid hostname: hostname can't have single quotes.");
-+ "Invalid hostname: hostname can't have single quotes.");
- return NULL;
- }
-
-- script = (char*) malloc(32 + strlen(url) + strlen(host));
-+ script = (char*) malloc(32 + strlen(sanitized_url) + strlen(host));
- script[0] = '\0';
- strcat(script, "FindProxyForURL('");
- strcat(script, sanitized_url);
---
-2.30.2
-
diff --git a/debian/patches/fix-build-error-if-git-not-installed.patch b/debian/patches/fix-build-error-if-git-not-installed.patch
new file mode 100644
index 0000000..46146ec
--- /dev/null
+++ b/debian/patches/fix-build-error-if-git-not-installed.patch
@@ -0,0 +1,15 @@
+--- a/src/pymod/setup.py
++++ b/src/pymod/setup.py
+@@ -67,9 +67,9 @@
+ ))
+
+ def pacparser_version():
+- if subprocess.call('git rev-parse --git-dir'.split(' '),
+- stderr=subprocess.DEVNULL) == 0:
+- return git_version()
++ #if subprocess.call('git rev-parse --git-dir'.split(' '),
++ # stderr=subprocess.DEVNULL) == 0:
++ # return git_version()
+
+ # Check if we have version.mk. It's added in the manual release tarball.
+ version_file = os.path.join(setup_dir(), '..', 'version.mk')
diff --git a/debian/patches/py3only.patch b/debian/patches/py3only.patch
index 6a74db7..0a96294 100644
--- a/debian/patches/py3only.patch
+++ b/debian/patches/py3only.patch
@@ -6,12 +6,10 @@ Origin: vendor
Forwarded: not-needed
Last-Update: 2020-03-02
-Index: pacparser-1.3.6/src/Makefile
-===================================================================
---- pacparser-1.3.6.orig/src/Makefile
-+++ pacparser-1.3.6/src/Makefile
-@@ -58,7 +58,7 @@ endif
- CFLAGS = -g -DXP_UNIX -Wall -DVERSION=$(VERSION)
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -63,7 +63,7 @@
+ MAINT_CFLAGS := -g -DXP_UNIX -Wall -DVERSION=$(VERSION)
ifndef PYTHON
- PYTHON = python
@@ -19,10 +17,3 @@ Index: pacparser-1.3.6/src/Makefile
endif
# Spidermonkey library.
-@@ -134,5 +134,5 @@ install-pymod: pymod
-
- clean:
- rm -f $(LIBRARY_LINK) $(LIBRARY) libjs.a pacparser.o pactester pymod/pacparser_o_buildstamp jsapi_buildstamp
-- cd pymod && python setup.py clean --all
-+ cd pymod && $(PYTHON) setup.py clean --all
- cd spidermonkey && $(MAKE) clean
diff --git a/debian/patches/series b/debian/patches/series
index 0ca96d5..0f0855b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,2 @@
py3only.patch
-0001-Fix-possible-memory-overwrite-vulnerability.-134.patch
+fix-build-error-if-git-not-installed.patch
diff --git a/debian/rules b/debian/rules
index 117ed7c..e27e3c3 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,80 +1,30 @@
#!/usr/bin/make -f
-# -*- makefile -*-
-DPKG_EXPORT_BUILDFLAGS = 1
-include /usr/share/dpkg/buildflags.mk
+export DH_VERBOSE=1
+include /usr/share/dpkg/pkg-info.mk
-# This has to be exported to make some magic below work.
-export DH_OPTIONS
+PYVERSIONS = $(shell py3versions -vr)
+VERSION=$(DEB_VERSION_EPOCH_UPSTREAM)
+export NO_INTERNET=1
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
- CFLAGS += -O0
-else
- CFLAGS += -O2
-endif
+%:
+ dh $@ -with python3
-build3vers := $(shell py3versions -sv)
+override_dh_auto_build:
+ $(MAKE) -C src VERSION=$(VERSION)
-# Build
-build: build-arch build-indep
-build-arch: build-stamp
-build-indep: build-stamp
-build-stamp:
- NO_INTERNET=yes $(MAKE) -C src
- NO_INTERNET=yes $(MAKE) -C src pymod
- set -e && for i in $(build3vers); do \
- NO_INTERNET=yes $(MAKE) -C src pymod PYTHON=python$$i; \
+override_dh_install:
+ $(MAKE) -C src DESTDIR=$(CURDIR)/debian/tmp install
+ for py in $(PYVERSIONS); do \
+ $(MAKE) -C src DESTDIR=$(CURDIR)/debian/tmp install-pymod \
+ PACPARSER_VERSION=$(VERSION) \
+ EXTRA_ARGS=--install-layout=deb \
+ PYTHON=python$$py; \
done
- touch $@
+ dh_install
-clean:
- dh_testdir
- dh_testroot
- rm -f build-stamp
- rm -rf src/pymod/build/
+override_dh_auto_clean:
$(MAKE) -C src clean
- dh_clean
-
-install:
- dh_testdir
- dh_testroot
- dh_clean -k -s
- dh_installdirs -s
-
- # Install to debian/tmp
- NO_INTERNET=yes $(MAKE) -C src DESTDIR=$(CURDIR)/debian/tmp install
- set -e && for i in $(build3vers); do \
- NO_INTERNET=yes $(MAKE) -C src DESTDIR=$(CURDIR)/debian/tmp install-pymod EXTRA_ARGS=--install-layout=deb PYTHON=python$$i; \
- done
-
- dh_install -s --autodest
- dh_python3 -s
-
-# Must not depend on anything. This is to be called by
-# binary in another 'make' thread.
-binary-common:
- dh_testdir
- dh_testroot
- dh_installchangelogs -a
- dh_installdocs -a -XREADME.win32
- dh_installexamples -plibpacparser1 -X*.py
- dh_installexamples -ppython-pacparser -X*.c
- dh_installexamples -ppython3-pacparser -X*.c
- dh_installman -a
- dh_link -a
- dh_strip -a
- dh_compress -a
- dh_fixperms -a
- dh_makeshlibs -a -X_pacparser.so
- dh_installdeb -a
- dh_shlibdeps -a
- dh_gencontrol -a
- dh_md5sums -a
- dh_builddeb -a
-
-binary-arch: binary
-binary-indep: binary
-binary: build install
- $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
-
-.PHONY: build build-indep build-arch install binary binary-common binary-indep binary-arch clean
+ rm -f src/spidermonkey/js/src/jsautocfg.h
+ rm -rf src/pymod/build
+ rm -rf src/pymod/pacparser.egg-info
diff --git a/src/Makefile b/src/Makefile
index af10890..7be94a9 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -63,7 +63,7 @@ PREFIX ?= /usr
MAINT_CFLAGS := -g -DXP_UNIX -Wall -DVERSION=$(VERSION)
ifndef PYTHON
- PYTHON = python
+ PYTHON = python3
endif
# Spidermonkey library.
diff --git a/src/pymod/setup.py b/src/pymod/setup.py
index e0b4d4d..2c64b55 100644
--- a/src/pymod/setup.py
+++ b/src/pymod/setup.py
@@ -67,9 +67,9 @@ def git_version():
))
def pacparser_version():
- if subprocess.call('git rev-parse --git-dir'.split(' '),
- stderr=subprocess.DEVNULL) == 0:
- return git_version()
+ #if subprocess.call('git rev-parse --git-dir'.split(' '),
+ # stderr=subprocess.DEVNULL) == 0:
+ # return git_version()
# Check if we have version.mk. It's added in the manual release tarball.
version_file = os.path.join(setup_dir(), '..', 'version.mk')