dcavalca / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone
Blob Blame History Raw
From d313baf1d3a4756447e398ee55f8c6760f942d50 Mon Sep 17 00:00:00 2001
From: Pavlina Moravcova Varekova <pmoravco@redhat.com>
Date: Wed, 24 Apr 2019 10:29:14 +0200
Subject: [PATCH] Use --dpbath only with full path (RhBug:1696408)

Before the patch rpm treats the relative path as a full path.
The new behavior is similar to the "--root" option.
---
 lib/poptALL.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/poptALL.c b/lib/poptALL.c
index 9983c1e62..69fd49846 100644
--- a/lib/poptALL.c
+++ b/lib/poptALL.c
@@ -147,6 +147,10 @@ static void rpmcliAllArgCallback( poptContext con,
 	break;
     case POPT_DBPATH:
 	rpmcliConfigured();
+	if (arg && arg[0] != '/') {
+	    fprintf(stderr, _("arguments to --dbpath must begin with '/'\n"));
+	    exit(EXIT_FAILURE);
+	}
 	rpmPushMacro(NULL, "_dbpath", NULL, arg, RMIL_CMDLINE);
 	break;
     case POPT_SHOWVERSION:
-- 
2.21.0