aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Woodward2008-12-14 19:28:32 +0000
committerJason Woodward2008-12-14 19:28:32 +0000
commitbcfbf0b2a1ff3c6fa55cfbba43e751093b1ead3c (patch)
tree39eb593453f859ceba38848c4d9882685dd960d7 /src
parentcf086740bb58f5983a97c66c9f1d05cae9aab160 (diff)
downloadslapt-get-bcfbf0b2a1ff3c6fa55cfbba43e751093b1ead3c.tar.gz
fixed an initialization errror in slapt_is_required_by() that caused a segfault when removing with --no-deps.0.10.1
if no package sources are defined with a priority, disable use of priorities when dealing with /patches. This prevents the previous default slapt-get behavior from changing and causing confusion. With priorities, /patches is always assigned +1 above the package sources priority. So if no priorities were in use then anything found in any sources /patches always trumped anything else. This is probably the most correct behavior but it is still unexpected for existing users. To get the correct behavior, assign a priority to one or more sources.
Diffstat (limited to 'src')
-rw-r--r--src/configuration.c4
-rw-r--r--src/configuration.h1
-rw-r--r--src/package.c17
3 files changed, 14 insertions, 8 deletions
diff --git a/src/configuration.c b/src/configuration.c
index 7834b6d..15e5977 100644
--- a/src/configuration.c
+++ b/src/configuration.c
@@ -39,6 +39,7 @@ slapt_rc_config *slapt_init_config(void)
global_config->re_install = SLAPT_FALSE;
global_config->remove_obsolete = SLAPT_FALSE;
global_config->no_upgrade = SLAPT_FALSE;
+ global_config->use_priority = SLAPT_FALSE;
global_config->working_dir[0] = '\0';
global_config->progress_cb = NULL;
@@ -80,6 +81,9 @@ slapt_rc_config *slapt_read_rc_config(const char *file_name)
slapt_source_t *s = slapt_init_source(token_ptr + strlen(SLAPT_SOURCE_TOKEN));
if (s != NULL) {
slapt_add_source(global_config->sources,s);
+ if (s->priority != SLAPT_PRIORITY_DEFAULT) {
+ global_config->use_priority = SLAPT_TRUE;
+ }
}
}
diff --git a/src/configuration.h b/src/configuration.h
index 7dbeb39..aee7560 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -42,6 +42,7 @@ typedef struct {
SLAPT_BOOL_T remove_obsolete;
SLAPT_BOOL_T no_upgrade;
unsigned int retry;
+ SLAPT_BOOL_T use_priority;
} slapt_rc_config;
/* initialize slapt_rc_config */
diff --git a/src/package.c b/src/package.c
index 8f3a759..56eb636 100644
--- a/src/package.c
+++ b/src/package.c
@@ -65,11 +65,11 @@ struct slapt_pkg_list *slapt_get_available_pkgs(void)
struct slapt_pkg_list *slapt_parse_packages_txt(FILE *pkg_list_fh)
{
slapt_regex_t *name_regex = NULL,
- *mirror_regex = NULL,
+ *mirror_regex = NULL,
*priority_regex = NULL,
- *location_regex = NULL,
- *size_c_regex = NULL,
- *size_u_regex = NULL;
+ *location_regex = NULL,
+ *size_c_regex = NULL,
+ *size_u_regex = NULL;
ssize_t bytes_read;
struct slapt_pkg_list *list = NULL;
long f_pos = 0;
@@ -1736,7 +1736,7 @@ struct slapt_pkg_list *slapt_is_required_by(const slapt_rc_config *global_config
struct slapt_pkg_list *avail,
slapt_pkg_info_t *pkg)
{
- struct slapt_pkg_list *required_by_list = NULL;
+ struct slapt_pkg_list *required_by_list = slapt_init_pkg_list();
/*
* don't go any further if disable_dep_check is set
@@ -1744,8 +1744,6 @@ struct slapt_pkg_list *slapt_is_required_by(const slapt_rc_config *global_config
if (global_config->disable_dep_check == SLAPT_TRUE)
return required_by_list;
- required_by_list = slapt_init_pkg_list();
-
required_by(avail,pkg,required_by_list);
return required_by_list;
@@ -2045,7 +2043,10 @@ int slapt_update_pkg_cache(const slapt_rc_config *global_config)
}
/* set the priority of the package based on the source, plus 1 for the patch priority */
- p->priority = source_priority + 1;
+ if (global_config->use_priority == SLAPT_TRUE)
+ p->priority = source_priority + 1;
+ else
+ p->priority = source_priority;
slapt_add_pkg_to_pkg_list(new_pkgs,p);
}