This is for active development.
New funtionalities are to be added actively.
Revision | 12c96c00c54d1b56c2472457377339c11e0a00d9 (tree) |
---|---|
Time | 2022-03-24 02:10:15 |
Author | ![]() |
Commiter | Mamoru Sakaue |
[IMPROVED] Adapt to the behavior change grep(1) as of 12.0-RELEASE that the case distinction is ineffective in some locale, which as a result prevented the execution by users in such locales.
[BUG FIX] Directories mounted by ZFS were not correctly treated by portsreinstall-chroot(8).
[BUG FIX] The mount command of portsreinstall-chroot(8) failed if the base directory path is under a directory to be mounted for the chroot environment (ex. when /home is a link to /usr/home).
[BUG FIX] Restarted runs failed if paths set to option values or their parent paths are symbolic links.
[BUG FIX] The mount command of portsreinstall-chroot(8) failed to detect mounted and unmounted file systems on mount points under symbolic links.
modified: HISTORY
modified: lib/chroot-mount/liboptions.sh
modified: lib/chroot/libfs.sh
modified: lib/chroot/liboptions.sh
modified: lib/libcommand_do.sh
modified: lib/libcommand_flexconf.sh
modified: lib/libcommand_forget.sh
modified: lib/libcommand_pkgs.sh
modified: lib/libconf.sh
modified: lib/libdatabase_build.sh
modified: lib/libdatabase_maintain.sh
modified: lib/libdatabase_query.sh
modified: lib/libdatabase_record.sh
modified: lib/libdeinstall.sh
modified: lib/libfileedit.sh
modified: lib/libfs.sh
modified: lib/libmain.sh
modified: lib/libmisc.sh
modified: lib/liboptions.sh
modified: lib/libpkgsys.sh
modified: lib/libprogram.sh
modified: lib/libreinstall.sh
modified: lib/main/liboptions.sh
modified: lib/upgrade/libcommand_do.sh
modified: lib/upgrade/liboptions.sh
modified: man/portsreinstall-chroot.8
@@ -1,5 +1,10 @@ | ||
1 | -4.1.1 (?? October 2021) | |
1 | +4.1.1 (?? December 2021) | |
2 | 2 | [IMPROVED] Adapt to the specification change of pkg-create(8) that the default extension of the package files become "pkg". |
3 | +[IMPROVED] Adapt to the behavior change grep(1) as of 12.0-RELEASE that the case distinction is ineffective in some locale, which as a result prevented the execution by users in such locales. | |
4 | +[BUG FIX] Directories mounted by ZFS were not correctly treated by portsreinstall-chroot(8). | |
5 | +[BUG FIX] The mount command of portsreinstall-chroot(8) failed if the base directory path is under a directory to be mounted for the chroot environment (ex. when /home is a link to /usr/home). | |
6 | +[BUG FIX] Restarted runs failed if paths set to option values or their parent paths are symbolic links. | |
7 | +[BUG FIX] The mount command of portsreinstall-chroot(8) failed to detect mounted and unmounted file systems on mount points under symbolic links. | |
3 | 8 | 4.1.0 (22 September 2018) |
4 | 9 | [NEW] Options -j and -x are added. |
5 | 10 | [NEW] Option -J is added to the all utilities. |
@@ -9,7 +9,7 @@ | ||
9 | 9 | |
10 | 10 | # ============= Database of options which are given at each run and not saved ============= |
11 | 11 | # [Syntax of option databases] |
12 | -# short_name, long_name, variable, defult_vaule, set_value | |
12 | +# short_name, long_name, variable, default_value, set_value | |
13 | 13 | # Columns are delimited by tab characters. |
14 | 14 | options_db_onetime () |
15 | 15 | { |
@@ -61,14 +61,18 @@ fs_save_mounttime_systembase () | ||
61 | 61 | # ============= Get the system base observed currently ============= |
62 | 62 | fs_get_current_systembase () |
63 | 63 | { |
64 | - cat "${TMPDIR}/fs_save_current_systembase" 2> /dev/null | |
64 | + local systembase | |
65 | + systembase=`cat "${TMPDIR}/fs_save_current_systembase" 2> /dev/null` | |
66 | + [ -z "$systembase" ] || realpath "$systembase" | |
65 | 67 | } |
66 | 68 | |
67 | 69 | # ============= Get the system base observed at the time of mounting ============= |
68 | 70 | # Non-zero return means no file system was attempted to mount |
69 | 71 | fs_get_mounttime_systembase () |
70 | 72 | { |
71 | - cat "${DBDIR}/fs_systembase" 2> /dev/null | |
73 | + local systembase | |
74 | + systembase=`cat "${DBDIR}/fs_systembase" 2> /dev/null` | |
75 | + [ -z "$systembase" ] || realpath "$systembase" | |
72 | 76 | } |
73 | 77 | |
74 | 78 | # ============= Get the system base in the scope of accessing ============= |
@@ -104,40 +108,89 @@ fs_build_chroot () | ||
104 | 108 | fs_safeguard_basedir "$opt_basedir" |
105 | 109 | fs_unmount || return |
106 | 110 | mkdir -p "$opt_basedir" |
107 | - # Prescan the f file system of the original environment | |
111 | + # Prescan the file system of the original environment | |
108 | 112 | cp /dev/null "${TMPDIR}/fs_build_chroot:directories" |
109 | 113 | ( |
114 | + real_basedir=`realpath "$opt_basedir"` | |
110 | 115 | { |
116 | +# echo bin compat etc lib libexec root sbin sys usr | tr ' ' '\n' | |
111 | 117 | echo bin compat etc lib libexec root sbin sys usr var | tr ' ' '\n' |
112 | 118 | echo "$opt_extra_dirs" | tr "$opt_extra_dirs_delim" '\n' |
113 | - } | grep -v '^[[:space:]]*$' | sort -u > ${TMPDIR}/fs_build_chroot:sys_dirs | |
114 | - sysdirs_ptn="^/*(`str_escape_regexp_filter < ${TMPDIR}/fs_build_chroot:sys_dirs | tr '\n' '|' | sed 's/\|$//'`)/+" | |
115 | - while read directory | |
119 | + } | env LANG=C grep -v '^[[:space:]]*$' | sort -u | while read node | |
116 | 120 | do |
117 | - [ -e "/$directory" ] || continue | |
118 | - if [ -L "/$directory" ] | |
121 | + [ -e "/$node" ] || continue | |
122 | + src_mountpoint_real=`realpath "/$node"` | |
123 | + ptn_src_mountpoint_real=`str_escape_regexp "$src_mountpoint_real/"` | |
124 | + if echo "$real_basedir" | grep -Eq "^$ptn_src_mountpoint_real" | |
119 | 125 | then |
120 | - src_mountpoint_real=`realpath "/$directory"` | |
121 | - printf '%s\t%s\n' link "$directory" >> ${TMPDIR}/fs_build_chroot:directories | |
122 | - if ! echo "$src_mountpoint_real/" | grep -qE "$sysdirs_ptn" | |
126 | + ( | |
127 | + node_cur=$node | |
128 | + rm -f "${TMPDIR}/fs_build_chroot:hit_exact" | |
129 | + while [ ! -e "${TMPDIR}/fs_build_chroot:hit_exact" ] | |
130 | + do | |
131 | + rm -f "${TMPDIR}/fs_build_chroot:hit_subnode" | |
132 | + cd "/$node_cur" | |
133 | + ls -a | while read subnode | |
134 | + do | |
135 | + if [ "$subnode" = . -o "$subnode" = .. ] | |
136 | + then | |
137 | + continue | |
138 | + elif [ -L "$subnode" -o -f "$subnode" ] | |
139 | + then | |
140 | + echo "$node_cur/$subnode" | |
141 | + elif [ -d "$subnode" ] | |
142 | + then | |
143 | + node_cur_tmp_real=`realpath "/$node_cur/$subnode"` | |
144 | + ptn_node_cur_tmp_real=`str_escape_regexp "$node_cur_tmp_real/"` | |
145 | + if [ "$real_basedir" = "$node_cur_tmp_real" ] | |
146 | + then | |
147 | + touch "${TMPDIR}/fs_build_chroot:hit_exact" | |
148 | + elif echo "$real_basedir" | grep -Eq "^$ptn_node_cur_tmp_real" | |
149 | + then | |
150 | + echo "$subnode" > ${TMPDIR}/fs_build_chroot:hit_subnode | |
151 | + else | |
152 | + echo "$node_cur/$subnode" | |
153 | + fi | |
154 | + fi | |
155 | + done | |
156 | + [ -e "${TMPDIR}/fs_build_chroot:hit_subnode" ] || break | |
157 | + node_cur=$node_cur/`cat "${TMPDIR}/fs_build_chroot:hit_subnode"` | |
158 | + done | |
159 | + ) | |
160 | + else | |
161 | + echo "$node" | |
162 | + fi | |
163 | + done > ${TMPDIR}/fs_build_chroot:sys_nodes | |
164 | + sysdirs_ptn="^/*(`str_escape_regexp_filter < ${TMPDIR}/fs_build_chroot:sys_nodes | tr '\n' '|' | sed 's/\|$//'`)/+" | |
165 | + while read node | |
166 | + do | |
167 | + [ -e "/$node" ] || continue | |
168 | + if [ -L "/$node" -a -d "/$node" ] | |
169 | + then | |
170 | + src_mountpoint_real=`realpath "/$node"` | |
171 | + printf '%s\t%s\n' link "$node" >> ${TMPDIR}/fs_build_chroot:directories | |
172 | + if ! echo "$src_mountpoint_real/" | env LANG=C grep -qE "$sysdirs_ptn" | |
123 | 173 | then |
124 | 174 | printf '%s\t%s\n' real "$src_mountpoint_real" >> ${TMPDIR}/fs_build_chroot:directories |
125 | 175 | tmpdir_descendant=${TMPDIR}/fs_build_chroot:descendant/$src_mountpoint_real |
126 | 176 | mkdir -p "$tmpdir_descendant" |
127 | 177 | fs_get_descendant_mount_info "/$src_mountpoint_real" > $tmpdir_descendant/list |
128 | 178 | fi |
129 | - elif [ -d "/$directory" ] | |
179 | + elif [ -d "/$node" ] | |
130 | 180 | then |
131 | - printf '%s\t%s\n' real $directory >> ${TMPDIR}/fs_build_chroot:directories | |
132 | - tmpdir_descendant=${TMPDIR}/fs_build_chroot:descendant/$directory | |
181 | + printf '%s\t%s\n' real $node >> ${TMPDIR}/fs_build_chroot:directories | |
182 | + tmpdir_descendant=${TMPDIR}/fs_build_chroot:descendant/$node | |
133 | 183 | mkdir -p "$tmpdir_descendant" |
134 | - fs_get_descendant_mount_info "/$directory" > $tmpdir_descendant/list | |
184 | + fs_get_descendant_mount_info "/$node" > $tmpdir_descendant/list | |
185 | + elif [ -L "/$node" -o -f "/$node" ] | |
186 | + then | |
187 | + cp -p "/$node" "$node" | |
135 | 188 | fi |
136 | - done < ${TMPDIR}/fs_build_chroot:sys_dirs | |
189 | + done < ${TMPDIR}/fs_build_chroot:sys_nodes | |
137 | 190 | ) |
138 | 191 | # Prepare the grand base of the chroot environment |
139 | 192 | ( |
140 | - cd "/$opt_basedir" | |
193 | + cd "$opt_basedir" | |
141 | 194 | for directory in builder mask store |
142 | 195 | do |
143 | 196 | [ -d $directory ] || mkdir $directory |
@@ -149,14 +202,16 @@ fs_build_chroot () | ||
149 | 202 | echo "$PORTSDIR" |
150 | 203 | echo "$PORTSNAP_WORKDIR" |
151 | 204 | echo "$PKGNG_PKG_CACHEDIR" |
152 | - fi | str_regularize_df_path_filter | grep -v '^[[:space:]]*$' | sort -u > ${DBDIR}/shared_dirs.lst | |
205 | + fi | str_regularize_df_path_filter | env LANG=C grep -v '^[[:space:]]*$' | sort -u > ${DBDIR}/shared_dirs.lst | |
153 | 206 | str_escape_regexp_filter < ${DBDIR}/shared_dirs.lst | sed 's|^|^|;s|$|\/|' > ${TMPDIR}/fs_build_chroot:shared_dirs.regexp.tmp |
154 | 207 | paste "${DBDIR}/shared_dirs.lst" "${TMPDIR}/fs_build_chroot:shared_dirs.regexp.tmp" > ${TMPDIR}/fs_build_chroot:shared_dirs.regexp |
155 | 208 | cp /dev/null "${TMPDIR}/fs_build_chroot:shared_dirs:added" |
156 | 209 | # Build target directories and the manifest for mounting |
210 | + mkdir -p "$opt_basedir/mask" | |
157 | 211 | cp /dev/null "${DBDIR}/mount_manifest.tmp" |
158 | 212 | ( |
159 | - cd "/$opt_basedir"/builder | |
213 | + real_basedir=`realpath "$opt_basedir"` | |
214 | + cd "$real_basedir"/builder | |
160 | 215 | while read srcline |
161 | 216 | do |
162 | 217 | type=`echo "$srcline" | cut -f 1` |
@@ -167,7 +222,7 @@ fs_build_chroot () | ||
167 | 222 | ;; |
168 | 223 | real ) |
169 | 224 | mkdir -p "./$directory" |
170 | - masktarget=/$opt_basedir/mask/$directory | |
225 | + masktarget=$real_basedir/mask/$directory | |
171 | 226 | mkdir -p "$masktarget" |
172 | 227 | printf '%s\t%s\t%s\t%s\n' nullfs "/$directory" "$directory" ro >> ${DBDIR}/mount_manifest.tmp |
173 | 228 | printf '%s\t%s\t%s\t%s\n' unionfs "$masktarget" "$directory" rw,noatime >> ${DBDIR}/mount_manifest.tmp |
@@ -181,10 +236,10 @@ fs_build_chroot () | ||
181 | 236 | rm -f "${TMPDIR}/fs_build_chroot:shared_dirs:is_itself" |
182 | 237 | while read -r shared_path shared_path_regexp |
183 | 238 | do |
184 | - echo "$fullpath/" | grep -qE "$shared_path_regexp" || continue | |
239 | + echo "$fullpath/" | env LANG=C grep -qE "$shared_path_regexp" || continue | |
185 | 240 | echo "$shared_path"$'\n'"$fullpath" | while read mpath |
186 | 241 | do |
187 | - if ! grep -qFx "$mpath" "${TMPDIR}/fs_build_chroot:shared_dirs:added" | |
242 | + if ! env LANG=C grep -qFx "$mpath" "${TMPDIR}/fs_build_chroot:shared_dirs:added" | |
188 | 243 | then |
189 | 244 | echo "$mpath" >> ${TMPDIR}/fs_build_chroot:shared_dirs:added |
190 | 245 | mkdir -p "/$mpath" |
@@ -197,7 +252,7 @@ fs_build_chroot () | ||
197 | 252 | [ -e "${TMPDIR}/fs_build_chroot:shared_dirs:is_under" ] && continue |
198 | 253 | case $fs in |
199 | 254 | normal ) |
200 | - masktarget=`str_regularize_df_path "/$opt_basedir/mask/$fullpath"` | |
255 | + masktarget=`str_regularize_df_path "$real_basedir/mask/$fullpath"` | |
201 | 256 | mkdir -p "$masktarget" |
202 | 257 | printf '%s\t%s\t%s\t%s\n' nullfs "$mp" "$fullpath" ro >> ${DBDIR}/mount_manifest.tmp |
203 | 258 | printf '%s\t%s\t%s\t%s\n' unionfs "$masktarget" "$fullpath" rw,noatime >> ${DBDIR}/mount_manifest.tmp |
@@ -222,7 +277,7 @@ fs_build_chroot () | ||
222 | 277 | ;; |
223 | 278 | esac |
224 | 279 | done < ${TMPDIR}/fs_build_chroot:directories |
225 | - grep -Ev -f "${TMPDIR}/fs_build_chroot:shared_dirs:added" "${DBDIR}/shared_dirs.lst" | while read shared_dir | |
280 | + env LANG=C grep -Ev -f "${TMPDIR}/fs_build_chroot:shared_dirs:added" "${DBDIR}/shared_dirs.lst" | while read shared_dir | |
226 | 281 | do |
227 | 282 | mkdir -p "$shared_dir" |
228 | 283 | mp_share=`realpath "$shared_dir"` |
@@ -237,7 +292,7 @@ fs_build_chroot () | ||
237 | 292 | printf '%s\t%s\t%s\t%s\n' procfs proc proc rw >> ${DBDIR}/mount_manifest.tmp |
238 | 293 | printf '%s\t%s\t%s\t%s\n' tmpfs tmpfs tmp rw,mode=1777 >> ${DBDIR}/mount_manifest.tmp |
239 | 294 | mkdir -p ."${PROGRAM}" |
240 | - cd "/$opt_basedir/mask" | |
295 | + cd "$real_basedir/mask" | |
241 | 296 | if [ ! -e root/.cshrc ] |
242 | 297 | then |
243 | 298 | tmp_cshrc=${TMPDIR}/fs_build_chroot:.cshrc |
@@ -257,7 +312,7 @@ fs_build_chroot () | ||
257 | 312 | echo 'set prompt="%N@[builder]%m:%~ %# "' >> $tmp_cshrc |
258 | 313 | mv "$tmp_cshrc" root/.cshrc |
259 | 314 | fi |
260 | - printf '%s\t%s\t%s\t%s\n' nullfs "/$opt_basedir"/store ".${PROGRAM}" rw >> ${DBDIR}/mount_manifest.tmp | |
315 | + printf '%s\t%s\t%s\t%s\n' nullfs "$real_basedir"/store ".${PROGRAM}" rw >> ${DBDIR}/mount_manifest.tmp | |
261 | 316 | ) |
262 | 317 | mv "${DBDIR}/mount_manifest.tmp" "${DBDIR}/mount_manifest" |
263 | 318 | } |
@@ -279,7 +334,8 @@ fs_chk_mount () | ||
279 | 334 | directory=`echo "$srcline" | cut -f 3` |
280 | 335 | opt=`echo "$srcline" | cut -f 4` |
281 | 336 | mp=`str_regularize_df_path "$systembase_mp/$opt_basedir/builder/$directory"` |
282 | - if ! fs_chk_mounted "$type" "$target" "$mp" | |
337 | + expr "$target" : \\/ && target=`realpath "$target"` | |
338 | + if ! real_mp=`realpath "$mp" 2> /dev/null` || ! fs_chk_mounted "$type" "$target" "$real_mp" | |
283 | 339 | then |
284 | 340 | printf '%s\t%s\t%s\n' "$type" "$target" "$mp" >> $tmp_remains |
285 | 341 | fi |
@@ -412,8 +468,9 @@ fs_chk_unmount () | ||
412 | 468 | [ "x$type" = xnullfs -o "x$type" = xunionfs ] && target=$systembase_target/$target |
413 | 469 | directory=`echo "$srcline" | cut -f 3` |
414 | 470 | opt=`echo "$srcline" | cut -f 4` |
415 | - mp=$systembase_mp/$opt_basedir/builder/$directory | |
416 | - fs_chk_mounted "$type" "$target" "$mp" || continue | |
471 | + mp=`str_regularize_df_path "$systembase_mp/$opt_basedir/builder/$directory"` | |
472 | + real_mp=`realpath "$mp" 2> /dev/null` || continue | |
473 | + fs_chk_mounted "$type" "$target" "$real_mp" || continue | |
417 | 474 | str_regularize_df_path "$mp" >> $tmp_remains |
418 | 475 | done |
419 | 476 | ! cat "$tmp_remains" 2> /dev/null |
@@ -9,7 +9,7 @@ | ||
9 | 9 | |
10 | 10 | # ============= Database of options which are given at each run and not saved ============= |
11 | 11 | # [Syntax of option databases] |
12 | -# short_name, long_name, variable, defult_vaule, set_value | |
12 | +# short_name, long_name, variable, default_value, set_value | |
13 | 13 | # Columns are delimited by tab characters. |
14 | 14 | options_db_onetime () |
15 | 15 | { |
@@ -43,8 +43,16 @@ s share-port-pkgs-dirs opt_share_port_pkgs_dirs no yes | ||
43 | 43 | eof |
44 | 44 | } |
45 | 45 | |
46 | -# ============= Regularize the option value ============= | |
47 | -options_regularize () | |
46 | +# ============= Definitions of value regulator functions ============= | |
47 | +options_db_value_regulators () | |
48 | 48 | { |
49 | - opt_basedir=`fs_global_path "$opt_basedir"` | |
49 | + cat << eof | |
50 | +opt_basedir options_regularize_to_global_path | |
51 | +eof | |
52 | +} | |
53 | + | |
54 | +# ============= Regularize a value of an option value: conversion of a oath into the global path ============= | |
55 | +options_regularize_to_global_path () | |
56 | +{ | |
57 | + fs_global_path "$1" | |
50 | 58 | } |
@@ -274,10 +274,10 @@ command_do_reset_changed_portdb () | ||
274 | 274 | str_escape_regexp_filter < $tmp_ls.uninspected.dbfile | sed 's/^/^/;s/$/[[:space:]]/' > $tmp_ls.uninspected.dbfile_ptn |
275 | 275 | paste "$tmp_ls.uninspected.dbfile_ptn" "$tmp_ls.uninspected.logname" | while read -r dbfile_ptn logname |
276 | 276 | do |
277 | - grep -E "$dbfile_ptn" < $tmp_ls.log > ${DBDIR}/ls_dbdir/$logname.log 2> /dev/null || : | |
277 | + env LANG=C grep -E "$dbfile_ptn" < $tmp_ls.log > ${DBDIR}/ls_dbdir/$logname.log 2> /dev/null || : | |
278 | 278 | done |
279 | 279 | str_escape_regexp_filter < $tmp_ls.nonexistent.db | sed 's/^/^/;s/$/[[:space:]]/' > $tmp_ls.nonexistent.db_ptn |
280 | - grep -E -f "$tmp_ls.nonexistent.db_ptn" < $tmp_ls.log | pkgsys_register_list_nonexistent_portopriondb | |
280 | + env LANG=C grep -E -f "$tmp_ls.nonexistent.db_ptn" < $tmp_ls.log | pkgsys_register_list_nonexistent_portopriondb | |
281 | 281 | message_echo |
282 | 282 | [ ! -e "$tmp_ls.updated" ] |
283 | 283 | } |
@@ -329,7 +329,7 @@ command_do_convert_dependency_lists_to_actual_ones () | ||
329 | 329 | if [ -e "$target.src" ] |
330 | 330 | then |
331 | 331 | sed -E -f "${DBDIR}/REPLACE.complete_sed_pattern" "$target.src" \ |
332 | - | grep -v '^$' | sort -u > $target.tmp | |
332 | + | env LANG=C grep -v '^$' | sort -u > $target.tmp | |
333 | 333 | [ -e "$target" ] && ! diff -q "$target.tmp" "$target" > /dev/null \ |
334 | 334 | && echo "$origin" >> ${DBDIR}/update_dependencies |
335 | 335 | mv "$target.tmp" "$target" |
@@ -354,13 +354,13 @@ command_do_convert_dependency_lists_to_actual_ones () | ||
354 | 354 | find . -depth 3 -type f -name requirements.${tag}.full -or -name requirements.${tag}.full.orig ) \ |
355 | 355 | | sort -u \ |
356 | 356 | | sed 's|^./||;s|/[^/]*$||' \ |
357 | - | grep -v -Fx -f "${DBDIR}/update_dependencies" \ | |
357 | + | env LANG=C grep -v -Fx -f "${DBDIR}/update_dependencies" \ | |
358 | 358 | > ${TMPDIR}/convert_requirements_list:full_complete.grep_pattern || : |
359 | 359 | ( cd "${DBDIR}/requires" && \ |
360 | 360 | find . -depth 3 -type f -name requirements.${tag}.direct -or -name requirements.${tag}.direct.orig ) \ |
361 | 361 | | sort -u \ |
362 | 362 | | sed 's|^./||;s|/[^/]*$||' \ |
363 | - | grep -v -Fx -f "${TMPDIR}/convert_requirements_list:full_complete.grep_pattern" \ | |
363 | + | env LANG=C grep -v -Fx -f "${TMPDIR}/convert_requirements_list:full_complete.grep_pattern" \ | |
364 | 364 | > ${DBDIR}/stage.loop_list/complete_recursive_${tag}time_reqlists || : |
365 | 365 | done |
366 | 366 | for inspected_level_tmp in direct node |
@@ -423,7 +423,7 @@ command_do_trim_dependency_lists_by_removing_uninspected_ports () | ||
423 | 423 | do |
424 | 424 | srcdb=requirements.${tag}.${level} |
425 | 425 | [ -e "$dbpath/$srcdb" ] || continue |
426 | - grep -Fx -f "${DBDIR}/inspected_ports" "$dbpath/$srcdb" > $dbpath/$srcdb.tmp || : | |
426 | + env LANG=C grep -Fx -f "${DBDIR}/inspected_ports" "$dbpath/$srcdb" > $dbpath/$srcdb.tmp || : | |
427 | 427 | mv "$dbpath/$srcdb.tmp" "$dbpath/$srcdb" |
428 | 428 | done |
429 | 429 | done |
@@ -621,7 +621,7 @@ command_do_post_process_after_the_preparation_of_target_attribute_information () | ||
621 | 621 | { |
622 | 622 | message_section_title "Post-process after the preparation of target attribute information" |
623 | 623 | sort -u "${DBDIR}/all_targets.lst" 2> /dev/null \ |
624 | - | grep -Fx -f "${DBDIR}/inspected_ports" \ | |
624 | + | env LANG=C grep -Fx -f "${DBDIR}/inspected_ports" \ | |
625 | 625 | | sed -E -f "${DBDIR}/REPLACE.complete_sed_pattern" 2> /dev/null \ |
626 | 626 | > ${DBDIR}/all_targets.lst.tmp || : |
627 | 627 | mv "${DBDIR}/all_targets.lst.tmp" "${DBDIR}/all_targets.lst" |
@@ -792,7 +792,7 @@ command_do_preparation_for_inspection_of_new_leaf_ports () | ||
792 | 792 | fileedit_manipulate_new_lines \ |
793 | 793 | "${TMPDIR}/PREPARE_INSPECT_LEAF_PORTS:nonleaf_ports" \ |
794 | 794 | "${TMPDIR}/PREPARE_INSPECT_LEAF_PORTS:inspected_ports" \ |
795 | - | grep -v -Fx -f "${DBDIR}/conf/HOLD:PORTS.parsed" 2> /dev/null \ | |
795 | + | env LANG=C grep -v -Fx -f "${DBDIR}/conf/HOLD:PORTS.parsed" 2> /dev/null \ | |
796 | 796 | > ${DBDIR}/stage.loop_list/leaf_ports_primary_candidates || : |
797 | 797 | cp /dev/null "${DBDIR}/leaf_ports.filter" |
798 | 798 | cp /dev/null "${DBDIR}/stage.loop_list/leaf_ports_secondary_candidates" |
@@ -815,8 +815,8 @@ command_do_inspection_of_new_primary_leaf_ports () | ||
815 | 815 | origin=$1 |
816 | 816 | pkgsys_is_pkgtool "$origin" && return |
817 | 817 | dbpath=${DBDIR}/requires/$origin |
818 | - grep -q -Fx "$origin" "${DBDIR}/need.with_replaced.list" 2> /dev/null && return | |
819 | - if ! grep -q -Fx "$origin" "${DBDIR}/noneed.list" 2> /dev/null | |
818 | + env LANG=C grep -q -Fx "$origin" "${DBDIR}/need.with_replaced.list" 2> /dev/null && return | |
819 | + if ! env LANG=C grep -q -Fx "$origin" "${DBDIR}/noneed.list" 2> /dev/null | |
820 | 820 | then |
821 | 821 | if [ -e "$dbpath/initial_orig" ] |
822 | 822 | then |
@@ -832,7 +832,7 @@ command_do_inspection_of_new_primary_leaf_ports () | ||
832 | 832 | if [ -e "$dbpath/requirements.all.full" -o -e "$dbpath/ignored_requirements.all" ] |
833 | 833 | then |
834 | 834 | cat "$dbpath/requirements.all.full" "$dbpath/ignored_requirements.all" 2> /dev/null | \ |
835 | - grep -v -Fx -f "${DBDIR}/conf/HOLD:PORTS.parsed" 2> /dev/null| \ | |
835 | + env LANG=C grep -v -Fx -f "${DBDIR}/conf/HOLD:PORTS.parsed" 2> /dev/null| \ | |
836 | 836 | fileedit_add_lines_if_new "${DBDIR}/stage.loop_list/leaf_ports_secondary_candidates" || : |
837 | 837 | fi |
838 | 838 | fileedit_add_a_line_if_new "$origin" "${DBDIR}/leaf_ports.filter" |
@@ -871,9 +871,9 @@ command_do_inspection_of_requirements_of_new_leaf_ports () | ||
871 | 871 | origin=$1 |
872 | 872 | pkgsys_is_pkgtool "$origin" && return |
873 | 873 | dbpath=${DBDIR}/requires/$origin |
874 | - grep -q -Fx "$origin" "${DBDIR}/need.with_replaced.list" 2> /dev/null && return | |
874 | + env LANG=C grep -q -Fx "$origin" "${DBDIR}/need.with_replaced.list" 2> /dev/null && return | |
875 | 875 | cat "$dbpath/dependents.all.full" "$dbpath/ignored_dependents.all" 2> /dev/null \ |
876 | - | grep -Fxq -v -f "${DBDIR}/leaf_ports.filter" 2> /dev/null && return | |
876 | + | env LANG=C grep -Fxq -v -f "${DBDIR}/leaf_ports.filter" 2> /dev/null && return | |
877 | 877 | cat "$dbpath/requirements.all.full" "$dbpath/ignored_requirements.all" 2> /dev/null \ |
878 | 878 | >> ${DBDIR}/leaf_ports_secondary_candidates.new_requirements || : |
879 | 879 | fileedit_add_a_line_if_new "$origin" "${DBDIR}/leaf_ports.filter" |
@@ -889,10 +889,10 @@ command_do_inspection_of_requirements_of_new_leaf_ports () | ||
889 | 889 | break |
890 | 890 | fi |
891 | 891 | { |
892 | - grep -Fx -v -f "${DBDIR}/leaf_ports.filter" \ | |
892 | + env LANG=C grep -Fx -v -f "${DBDIR}/leaf_ports.filter" \ | |
893 | 893 | "${DBDIR}/stage.loop_list/leaf_ports_secondary_candidates" || : |
894 | 894 | cat "${DBDIR}/leaf_ports_secondary_candidates.new_requirements" || : |
895 | - } 2> /dev/null | grep -v -Fx -f "${DBDIR}/conf/HOLD:PORTS.parsed" 2> /dev/null | sort -u \ | |
895 | + } 2> /dev/null | env LANG=C grep -v -Fx -f "${DBDIR}/conf/HOLD:PORTS.parsed" 2> /dev/null | sort -u \ | |
896 | 896 | > ${DBDIR}/stage.loop_list/leaf_ports_secondary_candidates.tmp || : |
897 | 897 | program_reset_loop_for_stage INSPECT_REQUIREMENTS_OF_LEAF_PORTS |
898 | 898 | mv "${DBDIR}/stage.loop_list/leaf_ports_secondary_candidates.tmp" \ |
@@ -902,7 +902,7 @@ command_do_inspection_of_requirements_of_new_leaf_ports () | ||
902 | 902 | num_inspect=`wc -l < ${DBDIR}/stage.loop_list/leaf_ports_secondary_candidates | tr -d ' '` |
903 | 903 | message_echo " $num_leaves_new leaf port(s) is/are newly found; continue for $num_inspect candidate(s)." |
904 | 904 | done |
905 | - grep -Fx -f "${DBDIR}/leaf_ports.filter" "${DBDIR}/inspected_ports" 2> /dev/null | sort -u > ${DBDIR}/leaf_ports || : | |
905 | + env LANG=C grep -Fx -f "${DBDIR}/leaf_ports.filter" "${DBDIR}/inspected_ports" 2> /dev/null | sort -u > ${DBDIR}/leaf_ports || : | |
906 | 906 | message_echo |
907 | 907 | } |
908 | 908 | program_exec_and_record_completion INSPECT_REQUIREMENTS_OF_LEAF_PORTS |
@@ -1008,7 +1008,7 @@ command_do_collection_of_obsolete_ports_to_delete () | ||
1008 | 1008 | cat "${DBDIR}/initial/$origin/requirements.run.full" || : |
1009 | 1009 | cat "${DBDIR}/obsolete/$origin/requirements.run.full" || : |
1010 | 1010 | done | sort -u > $reqptn_file |
1011 | - grep -v -Fx -f "$reqptn_file" "$src_selected" > $dst_selected 2> /dev/null || : | |
1011 | + env LANG=C grep -v -Fx -f "$reqptn_file" "$src_selected" > $dst_selected 2> /dev/null || : | |
1012 | 1012 | message_echo |
1013 | 1013 | } |
1014 | 1014 | program_exec_and_record_completion COLLECT_OBSOLETE_PORTS_TO_DELETE |
@@ -1049,7 +1049,7 @@ command_do_composition_of_a_list_for_deinstallation_of_obsolete_and_leaf_package | ||
1049 | 1049 | if [ ! -e "${DBDIR}/inspected_ports_only_partially" ] |
1050 | 1050 | then |
1051 | 1051 | cat "$reqptn_leaf" "$reqptn_obs" 2> /dev/null | sort -u > $grepptn |
1052 | - grep -v -Fx -f "$grepptn" "$leaf_selected_src" 2> /dev/null \ | |
1052 | + env LANG=C grep -v -Fx -f "$grepptn" "$leaf_selected_src" 2> /dev/null \ | |
1053 | 1053 | | database_query_add_initial_origins > $leaf_selected || : |
1054 | 1054 | cat "$obs_selected" "$leaf_selected" 2> /dev/null || : |
1055 | 1055 | else |
@@ -1059,11 +1059,11 @@ command_do_composition_of_a_list_for_deinstallation_of_obsolete_and_leaf_package | ||
1059 | 1059 | str_escape_regexp_filter < ${DBDIR}/stage.loop_list/ports_to_delete \ |
1060 | 1060 | | sed 's/^/^/;s/$/[[:space:]]/' > $grepptn_col1 |
1061 | 1061 | cat "${DBDIR}/leaf_ports.with_ini" "${DBDIR}/obsolete_ports" 2> /dev/null \ |
1062 | - | grep -Fx -v -f "${DBDIR}/stage.loop_list/ports_to_delete" > ${DBDIR}/stage.loop_list/ports_to_restore 2> /dev/null || : | |
1062 | + | env LANG=C grep -Fx -v -f "${DBDIR}/stage.loop_list/ports_to_delete" > ${DBDIR}/stage.loop_list/ports_to_restore 2> /dev/null || : | |
1063 | 1063 | if [ $opt_batch_mode = no ] |
1064 | 1064 | then |
1065 | 1065 | if [ ! -e "${DBDIR}/inspected_ports_only_partially" ] && \ |
1066 | - grep -v -Fx -f "${DBDIR}/stage.loop_list/ports_to_delete" "$leaf_selected_src" > $preserved 2> /dev/null | |
1066 | + env LANG=C grep -v -Fx -f "${DBDIR}/stage.loop_list/ports_to_delete" "$leaf_selected_src" > $preserved 2> /dev/null | |
1067 | 1067 | then |
1068 | 1068 | message_echo "INFO: Following leaf ports are preserved because required by other preserved leaf/obsolete ports." |
1069 | 1069 | message_echo "----------------" |
@@ -1079,7 +1079,7 @@ command_do_composition_of_a_list_for_deinstallation_of_obsolete_and_leaf_package | ||
1079 | 1079 | done < $preserved |
1080 | 1080 | message_echo "----------------" |
1081 | 1081 | fi |
1082 | - if grep -v -Fx -f "${DBDIR}/stage.loop_list/ports_to_delete" "$obs_selected_src" > $preserved 2> /dev/null | |
1082 | + if env LANG=C grep -v -Fx -f "${DBDIR}/stage.loop_list/ports_to_delete" "$obs_selected_src" > $preserved 2> /dev/null | |
1083 | 1083 | then |
1084 | 1084 | message_echo "INFO: Following obsolete ports are preserved because required by other obsolete ports." |
1085 | 1085 | message_echo "----------------" |
@@ -1112,7 +1112,7 @@ command_do_collect_entire_distfiles_list () | ||
1112 | 1112 | { |
1113 | 1113 | message_section_title "Collecting entire distfiles list" |
1114 | 1114 | find "${PORTSDIR}" -depth 3 -name distinfo -exec cat {} \; \ |
1115 | - | grep '^SHA256 ' | sed -E 's/^SHA256 \(([^)]*)\).*/\1/' \ | |
1115 | + | env LANG=C grep '^SHA256 ' | sed -E 's/^SHA256 \(([^)]*)\).*/\1/' \ | |
1116 | 1116 | | sort -u > ${DBDIR}/distfiles.entire.tmp |
1117 | 1117 | mv "${DBDIR}/distfiles.entire.tmp" "${DBDIR}/distfiles.entire" |
1118 | 1118 | message_echo |
@@ -1292,7 +1292,7 @@ command_do_rebuild_of_package_database () | ||
1292 | 1292 | { |
1293 | 1293 | which -s pkgdb || return 0 |
1294 | 1294 | message_section_title "Rebuilding package database for portupgrade" |
1295 | - if grep -q @ "${DBDIR}/stage.loop_list/reinst_todo" | |
1295 | + if env LANG=C grep -q @ "${DBDIR}/stage.loop_list/reinst_todo" | |
1296 | 1296 | then |
1297 | 1297 | message_echo "INFO: Skipped because of lacking flavor support." |
1298 | 1298 | else |
@@ -100,8 +100,8 @@ command_flexconf_update_freeze () | ||
100 | 100 | fileedit_combine_lists "${DBDIR}/conf/FREEZE:PORTS.parsed" "${DBDIR}/freeze.list" > ${DBDIR}/freeze.all.list |
101 | 101 | rm -f "$tmp_list:exists_update" |
102 | 102 | { |
103 | - grep -vFx -f "$tmp_list:old" "${DBDIR}/freeze.all.list" | |
104 | - grep -vFx -f "${DBDIR}/freeze.all.list" "$tmp_list:old" | |
103 | + env LANG=C grep -vFx -f "$tmp_list:old" "${DBDIR}/freeze.all.list" | |
104 | + env LANG=C grep -vFx -f "${DBDIR}/freeze.all.list" "$tmp_list:old" | |
105 | 105 | } | while read origin |
106 | 106 | do |
107 | 107 | touch "$tmp_list:exists_update" |
@@ -74,7 +74,7 @@ command_forget () | ||
74 | 74 | origin=$1 |
75 | 75 | origins_init=`database_query_initial_orgins "$origin"` |
76 | 76 | if [ -z "$origins_init" ] \ |
77 | - && ! grep -qv -Fx -f "${DBDIR}/forget/remove.scope.filter" \ | |
77 | + && ! env LANG=C grep -qv -Fx -f "${DBDIR}/forget/remove.scope.filter" \ | |
78 | 78 | "${DBDIR}/requires/$origin/dependents.all.full" \ |
79 | 79 | 2> /dev/null |
80 | 80 | then |
@@ -94,7 +94,7 @@ command_forget () | ||
94 | 94 | cat "${DBDIR}/forget/remove" || : |
95 | 95 | } 2> /dev/null | sort -u > ${DBDIR}/forget/remove.filter |
96 | 96 | cat "${DBDIR}/inspected_ports.update" 2> /dev/null | sort -u \ |
97 | - | grep -v -Fx -f "${DBDIR}/forget/remove.filter" \ | |
97 | + | env LANG=C grep -v -Fx -f "${DBDIR}/forget/remove.filter" \ | |
98 | 98 | > ${DBDIR}/inspected_ports.update.tmp 2> /dev/null || : |
99 | 99 | mv "${DBDIR}/inspected_ports.update.tmp" "${DBDIR}/inspected_ports.update" |
100 | 100 | message_echo |
@@ -77,7 +77,7 @@ command_pkgs_restore () | ||
77 | 77 | do |
78 | 78 | pkgsys_register_evaluated_globs remove "${DBDIR}/taboo.list" "$origin" |
79 | 79 | message_echo " Deregistered $origin from taboo." |
80 | - grep -Fx -q "$origin" "$tmp_done_orig" 2> /dev/null || : | |
80 | + env LANG=C grep -Fx -q "$origin" "$tmp_done_orig" 2> /dev/null || : | |
81 | 81 | if pkgsys_exists_from_orig "$origin" |
82 | 82 | then |
83 | 83 | pkg=`pkgsys_get_installed_pkg_from_origin "$origin"` |
@@ -159,7 +159,7 @@ command_pkgs_pkgsanity () | ||
159 | 159 | while read origin |
160 | 160 | do |
161 | 161 | pkgsys_get_installed_pkg_from_origin "$origin" |
162 | - done < $tmp_list.orgs | grep -v '^[[:space:]]*$' > $tmp_list.pkgs || { | |
162 | + done < $tmp_list.orgs | env LANG=C grep -v '^[[:space:]]*$' > $tmp_list.pkgs || { | |
163 | 163 | message_echo "WARNING: No such globs match any installed package." >&2 |
164 | 164 | temp_terminate_process () { :; } |
165 | 165 | exit 1 |
@@ -212,7 +212,7 @@ command_pkgs_pkgsanity () | ||
212 | 212 | iline=$((${iline}+1)) |
213 | 213 | origin=`pkg_info_flavored_origin "$pkg"` |
214 | 214 | [ -n "$origin" ] || continue |
215 | - grep -q -Fx "$origin" "${DBDIR}/damaged_package" 2>/dev/null && continue | |
215 | + env LANG=C grep -q -Fx "$origin" "${DBDIR}/damaged_package" 2>/dev/null && continue | |
216 | 216 | pkgsys_sanitychk_pkgcontents "$pkg" is_reinstall_encouraged && continue |
217 | 217 | port_path=`pkgsys_get_portpath_from_origin "$origin"` |
218 | 218 | if [ ! -d "$port_path" ] |
@@ -312,7 +312,7 @@ command_pkgs_packupgrade_create__manifest_reinst () | ||
312 | 312 | PROGRAM_DEPENDS=COMMAND_PACKUPGRADE_PREPARE |
313 | 313 | _program_exec_restartable_loop_operation__routine () |
314 | 314 | { |
315 | - local origin dstdir tmp_manifest dbdir_new pkgname pkgarc timestamp_inst timestamp_arc origin_old | |
315 | + local origin dstdir tmp_manifest dbdir_new pkgname pkgarc timestamp_inst timestamp_arc origin_old origin_equiv | |
316 | 316 | origin=$1 |
317 | 317 | dstdir=${DBDIR}/command_packupgrade |
318 | 318 | tmp_manifest=${TMPDIR}/packupgrade::manifest |
@@ -320,14 +320,14 @@ command_pkgs_packupgrade_create__manifest_reinst () | ||
320 | 320 | dbdir_new=${DBDIR}/requires/$origin |
321 | 321 | pkgname=`pkgsys_get_installed_pkg_from_origin "$origin"` |
322 | 322 | [ -n "$pkgname" ] || return 0 |
323 | - if ! grep -Fxq "$pkgname" "$dstdir/etc/created_packages.lst" 2> /dev/null | |
323 | + if ! env LANG=C grep -Fxq "$pkgname" "$dstdir/etc/created_packages.lst" 2> /dev/null | |
324 | 324 | then |
325 | 325 | if pkg_info_e "$pkgname" |
326 | 326 | then |
327 | 327 | if pkgarc=`pkgsys_pkgname_to_pkgarc "${PACKAGESDIR}" "$pkgname"` |
328 | 328 | then |
329 | 329 | timestamp_inst=`pkg_get_pkg_timestamp "$pkgname" 2> /dev/null` || : |
330 | - timestamp_arc=`ls -lD %s "$pkgarc" 2> /dev/null | sed -E 's/[[:space:]]+/ /g' | cut -w -f 6 | grep -v '^$'` || : | |
330 | + timestamp_arc=`ls -lD %s "$pkgarc" 2> /dev/null | sed -E 's/[[:space:]]+/ /g' | cut -w -f 6 | env LANG=C grep -v '^$'` || : | |
331 | 331 | else |
332 | 332 | timestamp_inst=1 |
333 | 333 | timestamp_arc=0 |
@@ -340,10 +340,14 @@ command_pkgs_packupgrade_create__manifest_reinst () | ||
340 | 340 | exit 1 |
341 | 341 | fi |
342 | 342 | fi |
343 | - elif grep -Fxq "$origin" ${DBDIR}/success.run.full.list | |
343 | + elif env LANG=C grep -Fxq "$origin" ${DBDIR}/success.run.full.list | |
344 | 344 | then |
345 | - message_echo "ERROR: Necessary package is missing [$origin]." >&2 | |
346 | - exit 1 | |
345 | + origin_equiv=`database_query_get_equivalent_orgin "$origin"` | |
346 | + if [ -z "$origin_equiv" ] || env LANG=C grep -Fxq "$origin_equiv" ${DBDIR}/success.run.full.list | |
347 | + then | |
348 | + message_echo "ERROR: Necessary package is missing [$origin]." >&2 | |
349 | + exit 1 | |
350 | + fi | |
347 | 351 | fi |
348 | 352 | fileedit_add_a_line_if_new "$pkgname" "$dstdir/etc/created_packages.lst" |
349 | 353 | fi |
@@ -55,7 +55,7 @@ conf_parse_vars_for_each_port_glob () | ||
55 | 55 | { |
56 | 56 | local section |
57 | 57 | section=$1 |
58 | - misc_get_all_vardefs | grep -e "^_CONF_${section}_" | cut -d = -f 1 | while read var | |
58 | + misc_get_all_vardefs | env LANG=C grep -e "^_CONF_${section}_" | cut -d = -f 1 | while read var | |
59 | 59 | do |
60 | 60 | eval glob_pattern=\${$var} |
61 | 61 | pkgsys_eval_ports_glob "$glob_pattern" |
@@ -69,7 +69,7 @@ conf_parse_vars_for_each_port_glob_with_bound_val () | ||
69 | 69 | section=$1 |
70 | 70 | tag_target=$2 |
71 | 71 | tag_val=$3 |
72 | - misc_get_all_vardefs | grep -e "^_CONF_${section}_${tag_target}_" | cut -d = -f 1 | while read var | |
72 | + misc_get_all_vardefs | env LANG=C grep -e "^_CONF_${section}_${tag_target}_" | cut -d = -f 1 | while read var | |
73 | 73 | do |
74 | 74 | eval glob_pattern=\${$var} |
75 | 75 | eval val=\$\{`echo "$var" | sed "s/^_CONF_${section}_${tag_target}_/_CONF_${section}_${tag_val}_/"`\} |
@@ -210,13 +210,13 @@ conf_manipulate_available_var_defs () | ||
210 | 210 | _CONFVARS='ENV ALT_MOVED HOLD TABOO FREEZE NOPKG REPLACE_FROM REPLACE_TO CONFLICT_TARGET CONFLICT_DEF BUILDCONFLICT_TARGET BUILDCONFLICT_DEF INSTCONFLICT_TARGET INSTCONFLICT_DEF MARG_TARGET MARG_DEF MENV_TARGET MENV_DEF BEFOREBUILD BEFOREDEINSTALL AFTERINSTALL' |
211 | 211 | for item in ${_CONFVARS} |
212 | 212 | do |
213 | - misc_get_all_vardefs | grep -e "^${item}_" | cut -d = -f 1 | sed 's/^/unset /' | |
213 | + misc_get_all_vardefs | env LANG=C grep -e "^${item}_" | cut -d = -f 1 | sed 's/^/unset /' | |
214 | 214 | done > $tmpfile_unsetvars |
215 | 215 | . "$tmpfile_unsetvars" |
216 | 216 | . "${DBDIR}/conf/complete_setup.sh" |
217 | 217 | for item in ${_CONFVARS} |
218 | 218 | do |
219 | - misc_get_all_vardefs | grep -e "^${item}_" | sed 's/^/_CONF_/' | |
219 | + misc_get_all_vardefs | env LANG=C grep -e "^${item}_" | sed 's/^/_CONF_/' | |
220 | 220 | done | sort -u > ${DBDIR}/conf/manipulated_defs.sh |
221 | 221 | ) || { message_echo "ERROR: Failed to manipulate available variable definitions from the configuration file." >&2; exit 1; } |
222 | 222 | } |
@@ -224,12 +224,12 @@ conf_manipulate_available_var_defs () | ||
224 | 224 | # ============= Build an effective MOVED database ============= |
225 | 225 | conf_build_effective_MOVED () |
226 | 226 | { |
227 | - grep -v -e '^[[:space:]]*#' -e '^[[:space:]]*$' "${PORTS_MOVED_DB}" > ${DBDIR}/conf/MOVED.parsed | |
228 | - misc_get_all_vardefs | grep -e '^_CONF_ALT_MOVED_' | cut -d = -f 1 | while read var | |
227 | + env LANG=C grep -v -e '^[[:space:]]*#' -e '^[[:space:]]*$' "${PORTS_MOVED_DB}" > ${DBDIR}/conf/MOVED.parsed | |
228 | + misc_get_all_vardefs | env LANG=C grep -e '^_CONF_ALT_MOVED_' | cut -d = -f 1 | while read var | |
229 | 229 | do |
230 | 230 | eval movedsb_path=\${$var} |
231 | 231 | cat "$movedsb_path" |
232 | - done | grep -v -e '^[[:space:]]*#' -e '^[[:space:]]*$' > ${DBDIR}/conf/MOVED_ALT.parsed || : | |
232 | + done | env LANG=C grep -v -e '^[[:space:]]*#' -e '^[[:space:]]*$' > ${DBDIR}/conf/MOVED_ALT.parsed || : | |
233 | 233 | cat "${DBDIR}/conf/MOVED_ALT.parsed" >> ${DBDIR}/conf/MOVED.parsed |
234 | 234 | } |
235 | 235 |
@@ -241,7 +241,7 @@ conf_setup_effective_env () | ||
241 | 241 | do |
242 | 242 | eval $key=\$\{_CONF_ENV_$key:-\$\{$key\}\} |
243 | 243 | done |
244 | - misc_get_all_vardefs | grep -e '^LOCALBASE=' -e '^LINUXBASE=' -e '^PORT_DBDIR=' -e '^PORTSDIR=' -e '^DISTDIR=' -e 'PACKAGES=' -e '^PKG_PATH=' -e '^PKGREPOSITORY=' -e '^PACKAGECHECKSUMROOTS=' -e '^PACKAGECHECKSUMDIR=' -e '^PACKAGEROOTS=' -e '^PACKAGEDIR=' | |
244 | + misc_get_all_vardefs | env LANG=C grep -e '^LOCALBASE=' -e '^LINUXBASE=' -e '^PORT_DBDIR=' -e '^PORTSDIR=' -e '^DISTDIR=' -e 'PACKAGES=' -e '^PKG_PATH=' -e '^PKGREPOSITORY=' -e '^PACKAGECHECKSUMROOTS=' -e '^PACKAGECHECKSUMDIR=' -e '^PACKAGEROOTS=' -e '^PACKAGEDIR=' | |
245 | 245 | ) |
246 | 246 | echo '[ -n "$PKG_PATH" ] && PKGREPOSITORY=$PKG_PATH' |
247 | 247 | echo 'conf_setup_ports_envs' |
@@ -257,7 +257,7 @@ conf_build_replacement_patterns_from_REPLACE () | ||
257 | 257 | cp /dev/null "${DBDIR}/conf/REPLACE.filter" |
258 | 258 | cp /dev/null "${DBDIR}/conf/REPLACE.sed_pattern" |
259 | 259 | cp /dev/null "${DBDIR}/conf/REPLACE.csv" |
260 | - misc_get_all_vardefs | grep -e '^_CONF_REPLACE_FROM_' | cut -d = -f 1 | while read var | |
260 | + misc_get_all_vardefs | env LANG=C grep -e '^_CONF_REPLACE_FROM_' | cut -d = -f 1 | while read var | |
261 | 261 | do |
262 | 262 | eval glob_pattern=\$\{$var\} |
263 | 263 | eval to=\$\{`echo "$var" | sed 's/^_CONF_REPLACE_FROM_/_CONF_REPLACE_TO_/'`\} |
@@ -41,7 +41,7 @@ database_build_convert_and_register_origin_if_obsolete () | ||
41 | 41 | echo "$origin" > ${TMPDIR}/database_build_convert_and_register_origin_if_obsolete:origin |
42 | 42 | pkgsys_exists_port "$origin" && return |
43 | 43 | database_build_register_obsolete_port "$origin" |
44 | - grep -n -m 1 -E "^`str_escape_regexp \"$origin\"`\|" "$recursedb" 2> /dev/null > ${TMPDIR}/moved.info || : | |
44 | + env LANG=C grep -n -m 1 -E "^`str_escape_regexp \"$origin\"`\|" "$recursedb" 2> /dev/null > ${TMPDIR}/moved.info || : | |
45 | 45 | if [ `wc -l < ${TMPDIR}/moved.info` -eq 0 ] |
46 | 46 | then |
47 | 47 | fileedit_add_a_line_if_new "$origin" "${DBDIR}/obsolete_ports" |
@@ -206,7 +206,7 @@ database_build_setup_replace_node () | ||
206 | 206 | rm -rf "$dbpath" |
207 | 207 | mkdir -p "$dbpath" |
208 | 208 | origin_trial=$origin_orig |
209 | - if echo "$origin_orig" | grep -q -Fx -f "${DBDIR}/conf/REPLACE.filter" 2> /dev/null | |
209 | + if echo "$origin_orig" | env LANG=C grep -q -Fx -f "${DBDIR}/conf/REPLACE.filter" 2> /dev/null | |
210 | 210 | then |
211 | 211 | origin_trial=`echo "$origin_orig" | sed -E -f "${DBDIR}/conf/REPLACE.sed_pattern"` |
212 | 212 | if [ "x$origin_orig" != "x$origin_trial" ] |
@@ -279,9 +279,9 @@ database_build_get_inspected_level () | ||
279 | 279 | then |
280 | 280 | echo full |
281 | 281 | elif ! pkgsys_exists_or_existed_from_orig "$origin" \ |
282 | - || grep -qFx "$origin" "${DBDIR}/stage.loop_list/ports_to_inspect" 2> /dev/null \ | |
282 | + || env LANG=C grep -qFx "$origin" "${DBDIR}/stage.loop_list/ports_to_inspect" 2> /dev/null \ | |
283 | 283 | || [ ! -e "${DBDIR}/moved_from/$origin_dependent/installed_version" ] \ |
284 | - || grep -qFx "$origin_dependent" "${DBDIR}/stage.loop_list/ports_to_inspect" 2> /dev/null | |
284 | + || env LANG=C grep -qFx "$origin_dependent" "${DBDIR}/stage.loop_list/ports_to_inspect" 2> /dev/null | |
285 | 285 | then |
286 | 286 | echo direct |
287 | 287 | else |
@@ -302,7 +302,7 @@ database_build_is_port_already_inspected_in_required_level () | ||
302 | 302 | cat "${DBDIR}/ports.inspected.${inspected_level}.list" || : |
303 | 303 | cat "${DBDIR}/moved_ports" || : |
304 | 304 | cat "${DBDIR}/obsolete_ports" || : |
305 | - } 2> /dev/null | grep -q -Fx "$origin_actual" || return | |
305 | + } 2> /dev/null | env LANG=C grep -q -Fx "$origin_actual" || return | |
306 | 306 | fileedit_rm_a_line "$origin" "${DBDIR}/stage.loop_list/ports_to_inspect.remain" |
307 | 307 | [ "x$origin" = "$origin_actual" ] || \ |
308 | 308 | fileedit_rm_a_line "$origin_actual" "${DBDIR}/stage.loop_list/ports_to_inspect.remain" |
@@ -374,7 +374,7 @@ database_build_get_full_run_requirement_pkgs () | ||
374 | 374 | while read origin |
375 | 375 | do |
376 | 376 | database_build_get_new_pkgname "$origin" |
377 | - done < $srcfile | grep -v '^[[:space:]]*$' | sort -u > $savefile | |
377 | + done < $srcfile | env LANG=C grep -v '^[[:space:]]*$' | sort -u > $savefile | |
378 | 378 | fi |
379 | 379 | cat "$savefile" 2> /dev/null || : |
380 | 380 | } |
@@ -471,7 +471,7 @@ database_build_determine_flavored_origin () | ||
471 | 471 | if [ -n "$flavor_trial" ] |
472 | 472 | then |
473 | 473 | flavors_ptn="^("`database_build_make "$origin" -V FLAVORS 2> /dev/null | sed -E 's/[[:space:]]+/|/g'`")$" |
474 | - echo "$flavor_trial" | grep -qE "$flavors_ptn" || flavor_trial= | |
474 | + echo "$flavor_trial" | env LANG=C grep -qE "$flavors_ptn" || flavor_trial= | |
475 | 475 | fi |
476 | 476 | origin_trial=`pkgsys_compose_flavored_origin "$origin_unflavored" "$flavor_trial"` |
477 | 477 | flavor=`database_build_make "$origin_trial" -V FLAVOR 2> /dev/null || :` |
@@ -576,7 +576,7 @@ database_build_inspect_dependencies () | ||
576 | 576 | [ "x$origin_orig" = "x$origin" ] || fileedit_add_a_line_if_new "$origin_orig" "$frompath/initial_orig" |
577 | 577 | [ -e "${DBDIR}/initial/$origin_orig/SUPPRESSED_SELF" ] && touch "$frompath/SUPPRESSED_SELF" |
578 | 578 | [ -e "${DBDIR}/initial/$origin_orig/SUPPRESSED_PKGNG" ] && touch "$frompath/SUPPRESSED_PKGNG" |
579 | - if ! grep -qFx "$origin" "${DBDIR}/done_required_ports_to_inspect" 2> /dev/null | |
579 | + if ! env LANG=C grep -qFx "$origin" "${DBDIR}/done_required_ports_to_inspect" 2> /dev/null | |
580 | 580 | then |
581 | 581 | fileedit_rm_a_line "$origin" "${DBDIR}/obsolete_ports" |
582 | 582 | fileedit_rm_a_line "$origin" "${DBDIR}/moved_ports" |
@@ -588,7 +588,7 @@ database_build_inspect_dependencies () | ||
588 | 588 | # Notify reconfiguration of the port option |
589 | 589 | conf_updated= |
590 | 590 | if [ -e "$dbpath/complete_as_node" ] || \ |
591 | - grep -q -Fx -e "$origin_orig" -e "$origin" "${DBDIR}/to_be_reconf" 2> /dev/null | |
591 | + env LANG=C grep -q -Fx -e "$origin_orig" -e "$origin" "${DBDIR}/to_be_reconf" 2> /dev/null | |
592 | 592 | then |
593 | 593 | message_echo "${DEPTH_INDEX} ===> Reconfigured" |
594 | 594 | conf_updated=y |
@@ -647,7 +647,7 @@ database_build_inspect_dependencies () | ||
647 | 647 | do |
648 | 648 | tr ' ' '\n' < ${TMPDIR}/database_build_inspect_dependencies:${tag}_depends_list | \ |
649 | 649 | sed -E 's#.*:([^:/]+/[^:/]+|[^:/]+/[^:/]+:[^:/]*)$#\1#' | cut -d : -f 1 | sort -u | \ |
650 | - grep -Ev "`pkgsys_pkgtools_ports_filter_regexp`" \ | |
650 | + env LANG=C grep -Ev "`pkgsys_pkgtools_ports_filter_regexp`" \ | |
651 | 651 | | while read origin_flavor_incomplete |
652 | 652 | do |
653 | 653 | ( set -e |
@@ -655,9 +655,9 @@ database_build_inspect_dependencies () | ||
655 | 655 | database_build_determine_port_option "$origin_flavor_incomplete" |
656 | 656 | ) |
657 | 657 | database_build_determine_flavored_origin "$origin_flavor_incomplete" |
658 | - done | grep -v '^$' | sort -u > $dbpath/requirements.$tag.orig || : | |
658 | + done | env LANG=C grep -v '^$' | sort -u > $dbpath/requirements.$tag.orig || : | |
659 | 659 | sed -E -f "${DBDIR}/conf/REPLACE.sed_pattern" "$dbpath/requirements.$tag.orig" \ |
660 | - | grep -v '^$' | sort -u > $dbpath/requirements.$tag.src || : | |
660 | + | env LANG=C grep -v '^$' | sort -u > $dbpath/requirements.$tag.src || : | |
661 | 661 | done |
662 | 662 | for stage in orig src |
663 | 663 | do |
@@ -695,12 +695,12 @@ database_build_inspect_dependencies () | ||
695 | 695 | inspected_level=`database_build_get_inspected_level "$origin" "$origin_dependent"` |
696 | 696 | case $inspected_level in |
697 | 697 | full ) |
698 | - grep -v -Fx -f "${DBDIR}/installed_ports" \ | |
698 | + env LANG=C grep -v -Fx -f "${DBDIR}/installed_ports" \ | |
699 | 699 | "$dbpath/requirements.all.direct.src" > ${TMPDIR}/missing.$origin_id || : |
700 | 700 | inspected_levels_compatible='full direct node' |
701 | 701 | ;; |
702 | 702 | direct ) |
703 | - grep -v -Fx -f "${DBDIR}/installed_ports" \ | |
703 | + env LANG=C grep -v -Fx -f "${DBDIR}/installed_ports" \ | |
704 | 704 | "$dbpath/requirements.all.direct.src" > ${TMPDIR}/missing.$origin_id || : |
705 | 705 | inspected_levels_compatible='direct node' |
706 | 706 | ;; |
@@ -716,7 +716,7 @@ database_build_inspect_dependencies () | ||
716 | 716 | do |
717 | 717 | origin_dependency=`sed -n ${iline}p "${TMPDIR}/missing.$origin_id"` |
718 | 718 | iline=$(($iline+1)) |
719 | - grep -q -Fx "$origin_dependency" "${DBDIR}/ports.inspected.list" 2> /dev/null && \ | |
719 | + env LANG=C grep -q -Fx "$origin_dependency" "${DBDIR}/ports.inspected.list" 2> /dev/null && \ | |
720 | 720 | continue |
721 | 721 | database_build_inspect_dependencies "$origin_dependency" "$origin" |
722 | 722 | done |
@@ -737,7 +737,7 @@ database_build_inspect_dependencies () | ||
737 | 737 | # Transfer data from the previous database if existent, successful and no change |
738 | 738 | pkg_new=`cat "$dbpath/new_version"` |
739 | 739 | if [ ! -e "$dbpath/conf_updated" -a -d "$dbpath_prev" ] && pkg_info_e "$pkg_new" 2> /dev/null && \ |
740 | - ! grep -qFx "$origin" "$dbpath_prev/to_be_reconf" 2> /dev/null | |
740 | + ! env LANG=C grep -qFx "$origin" "$dbpath_prev/to_be_reconf" 2> /dev/null | |
741 | 741 | then |
742 | 742 | same_as_prevset=yes |
743 | 743 | for dbfile in new_version CONFLICT.conf BUILDCONFLICT.conf MARG.conf MENV.conf \ |
@@ -772,7 +772,7 @@ database_build_inspect_dependencies () | ||
772 | 772 | then |
773 | 773 | for dbfile in failed.list damaged_package manually_done.list |
774 | 774 | do |
775 | - if grep -qFx "$origin" "${DBDIR}/prevset/$dbfile" 2> /dev/null | |
775 | + if env LANG=C grep -qFx "$origin" "${DBDIR}/prevset/$dbfile" 2> /dev/null | |
776 | 776 | then |
777 | 777 | same_as_prevset=no |
778 | 778 | break |
@@ -799,7 +799,7 @@ database_build_inspect_dependencies () | ||
799 | 799 | done |
800 | 800 | } | while read dbfile |
801 | 801 | do |
802 | - if grep -Fxq "$origin" "${DBDIR}/prevset/$dbfile" 2> /dev/null | |
802 | + if env LANG=C grep -Fxq "$origin" "${DBDIR}/prevset/$dbfile" 2> /dev/null | |
803 | 803 | then |
804 | 804 | fileedit_add_a_line_if_new "$origin" "${DBDIR}/$dbfile" |
805 | 805 | fi |
@@ -856,7 +856,7 @@ database_build_filter_ignored_requirements () | ||
856 | 856 | pattern=${DBDIR}/requires/$origin/ignored_requirements.filter |
857 | 857 | if [ -e "$pattern" ] |
858 | 858 | then |
859 | - grep -Fxvq -f "$pattern" | |
859 | + env LANG=C grep -Fxvq -f "$pattern" | |
860 | 860 | else |
861 | 861 | cat |
862 | 862 | fi 2> /dev/null || : |
@@ -882,9 +882,9 @@ database_build_get_complete_recursive_dependency () | ||
882 | 882 | then |
883 | 883 | touch "$tmppath.parents" |
884 | 884 | num_parents=`wc -l < $tmppath.parents` |
885 | - if grep -Fxq "$origin" "$tmppath.parents" | |
885 | + if env LANG=C grep -Fxq "$origin" "$tmppath.parents" | |
886 | 886 | then |
887 | - loophead=`grep -Fxn "$origin" "$tmppath.parents" | tail -n 1 | cut -d : -f 1` | |
887 | + loophead=`env LANG=C grep -Fxn "$origin" "$tmppath.parents" | tail -n 1 | cut -d : -f 1` | |
888 | 888 | if [ "x$opt_force_continuation_for_looped_dependency" = xno ] |
889 | 889 | then |
890 | 890 | message_echo "ERROR: The following loop was found for requirements.${tag}${suffix}:" >&2 |
@@ -913,8 +913,8 @@ database_build_get_complete_recursive_dependency () | ||
913 | 913 | origin_target=`sed -n ${index_loop}p "$tmppath.ports_in_loop"` |
914 | 914 | origin_ref=`sed -n $((${index_loop}+1))p "$tmppath.ports_in_loop"` |
915 | 915 | dbpath_target=${DBDIR}/requires/$origin_target |
916 | - if ! grep -Fxq "$origin_ref" "$dbpath_target/requirements.run.direct${suffix}" 2> /dev/null || \ | |
917 | - ! grep -Fxq "$origin_ref" "$dbpath_target/requirements.build.direct${suffix}" 2> /dev/null | |
916 | + if ! env LANG=C grep -Fxq "$origin_ref" "$dbpath_target/requirements.run.direct${suffix}" 2> /dev/null || \ | |
917 | + ! env LANG=C grep -Fxq "$origin_ref" "$dbpath_target/requirements.build.direct${suffix}" 2> /dev/null | |
918 | 918 | then |
919 | 919 | message_echo 'INFO: The dependency of '$origin_target' on '$origin_ref' is ignored to terminate the loop.' >&2 |
920 | 920 | break |
@@ -929,7 +929,7 @@ database_build_get_complete_recursive_dependency () | ||
929 | 929 | do |
930 | 930 | for tag_tmp in run build |
931 | 931 | do |
932 | - grep -Fxq "$origin_ref" "$dbpath_target/requirements.${tag_tmp}.direct${suffix_tmp}" 2> /dev/null && \ | |
932 | + env LANG=C grep -Fxq "$origin_ref" "$dbpath_target/requirements.${tag_tmp}.direct${suffix_tmp}" 2> /dev/null && \ | |
933 | 933 | fileedit_add_a_line_if_new "$origin_ref" "$dbpath_target/ignored_requirements.${tag_tmp}${suffix_tmp}" |
934 | 934 | done |
935 | 935 | cat "$dbpath_target/ignored_requirements.run${suffix_tmp}" "$dbpath_target/ignored_requirements.build${suffix_tmp}" 2> /dev/null | sort -u > $dbpath_target/ignored_requirements.all${suffix_tmp} |
@@ -948,7 +948,7 @@ database_build_get_complete_recursive_dependency () | ||
948 | 948 | [ "x$tag" = xbuild ] && tag_dep=run |
949 | 949 | recursive_dependency=`database_build_get_complete_recursive_dependency "$tag_dep" "$origin_requirement" "$suffix"` |
950 | 950 | [ -e "$dbpath/ignored_requirements.filter" ] && \ |
951 | - echo "$origin_requirement" | grep -Fxq -f "$dbpath/ignored_requirements.filter" 2> /dev/null && \ | |
951 | + echo "$origin_requirement" | env LANG=C grep -Fxq -f "$dbpath/ignored_requirements.filter" 2> /dev/null && \ | |
952 | 952 | continue |
953 | 953 | echo "$origin_requirement" |
954 | 954 | echo "$recursive_dependency" |
@@ -957,7 +957,7 @@ database_build_get_complete_recursive_dependency () | ||
957 | 957 | mv "$tmppath.parents.tmp" "$tmppath.parents" |
958 | 958 | if [ ! -e "$dstfile" ] |
959 | 959 | then |
960 | - sort -u "$dstfile_tmp" | grep -v '^$' > $dstfile || : | |
960 | + sort -u "$dstfile_tmp" | env LANG=C grep -v '^$' > $dstfile || : | |
961 | 961 | rm "$dstfile_tmp" |
962 | 962 | fi |
963 | 963 | fi |
@@ -1095,7 +1095,7 @@ database_build_order_ports_considering_dependencies () | ||
1095 | 1095 | (cd "${DBDIR}/requires" && \ |
1096 | 1096 | find . -depth 3 -name requirements.all.full -exec echo {} \; -exec cat {} \; -exec echo \;) | \ |
1097 | 1097 | env "DBDIR=${DBDIR}" awk -f "${LIBEXECDIR}"/order_dependencies.awk || return |
1098 | - grep -v '^$' "${DBDIR}/reinst_order.list.tmp" > "${DBDIR}/reinst_order.list" || : | |
1098 | + env LANG=C grep -v '^$' "${DBDIR}/reinst_order.list.tmp" > "${DBDIR}/reinst_order.list" || : | |
1099 | 1099 | } |
1100 | 1100 | |
1101 | 1101 | # ============= [Sub-function] Common operations for resetting configurations for a port ============= |
@@ -1187,7 +1187,7 @@ database_build_post_inspect_dependencies () | ||
1187 | 1187 | cat "${DBDIR}/conf/HOLD:PORTS.parsed" || : |
1188 | 1188 | cat "${DBDIR}/need.list" || : |
1189 | 1189 | } 2> /dev/null | sort -u > $tmpfile.obsolete_ports.exclude |
1190 | - grep -v -Fx -f "$tmpfile.obsolete_ports.exclude" "${DBDIR}/obsolete_ports" > ${DBDIR}/obsolete_ports.can_be_deleted || : | |
1190 | + env LANG=C grep -v -Fx -f "$tmpfile.obsolete_ports.exclude" "${DBDIR}/obsolete_ports" > ${DBDIR}/obsolete_ports.can_be_deleted || : | |
1191 | 1191 | cp /dev/null "${DBDIR}/REPLACE.complete_sed_pattern.tmp" |
1192 | 1192 | find "${DBDIR}/replace" -depth 3 -type f -name origin | while read nodepath |
1193 | 1193 | do |
@@ -1200,7 +1200,7 @@ database_build_post_inspect_dependencies () | ||
1200 | 1200 | mv "${DBDIR}/REPLACE.complete_sed_pattern.tmp" "${DBDIR}/REPLACE.complete_sed_pattern" |
1201 | 1201 | if [ `cat "${DBDIR}/inspected_ports.update" 2> /dev/null | wc -l` -gt 0 ] |
1202 | 1202 | then |
1203 | - grep -Fx -f "${DBDIR}/inspected_ports.all" "${DBDIR}/inspected_ports.update" \ | |
1203 | + env LANG=C grep -Fx -f "${DBDIR}/inspected_ports.all" "${DBDIR}/inspected_ports.update" \ | |
1204 | 1204 | > ${DBDIR}/inspected_ports.update.tmp 2> /dev/null || : |
1205 | 1205 | mv "${DBDIR}/inspected_ports.update.tmp" "${DBDIR}/inspected_ports.update" |
1206 | 1206 | if [ $opt_only_target_scope = yes ] |
@@ -52,7 +52,7 @@ database_maintain_create () | ||
52 | 52 | misc_lock_duplicated_executions "${DBDIR}/.lock" |
53 | 53 | if [ -e "${DBDIR}/MYVERSION" ] |
54 | 54 | then |
55 | - if ! grep -q -E "$COMPATIBLE_VERSIONS" "${DBDIR}/MYVERSION" 2> /dev/null | |
55 | + if ! env LANG=C grep -q -E "$COMPATIBLE_VERSIONS" "${DBDIR}/MYVERSION" 2> /dev/null | |
56 | 56 | then |
57 | 57 | message_echo "ERROR: The current temporary database is incompatible. You must delete it by" >&2 |
58 | 58 | message_echo " ${APPNAME} clean force" >&2 |
@@ -16,10 +16,10 @@ database_query_show_list_failure () | ||
16 | 16 | message_echo "INFO: No item is registered in this list." |
17 | 17 | return 1 |
18 | 18 | fi |
19 | - grep -v -E -f "${DBDIR}/ports_to_delete.grep_pattern" "${DBDIR}/failed.list" 2> /dev/null \ | |
19 | + env LANG=C grep -v -E -f "${DBDIR}/ports_to_delete.grep_pattern" "${DBDIR}/failed.list" 2> /dev/null \ | |
20 | 20 | | while read origin |
21 | 21 | do |
22 | - grep -q -Fx "$origin" "${DBDIR}/stage.loop_list/ports_to_delete" 2> /dev/null \ | |
22 | + env LANG=C grep -q -Fx "$origin" "${DBDIR}/stage.loop_list/ports_to_delete" 2> /dev/null \ | |
23 | 23 | || echo "$origin" |
24 | 24 | done > $tmp_valid |
25 | 25 | if [ `cat "$tmp_valid" 2> /dev/null | wc -l` -eq 0 ] |
@@ -31,7 +31,7 @@ database_query_show_list_failure () | ||
31 | 31 | do |
32 | 32 | note=`cat "${DBDIR}/notes/$origin/note_failtre" 2> /dev/null || :` |
33 | 33 | resolved=no |
34 | - grep -q -Fx "$origin" "${DBDIR}/manually_done.list" 2> /dev/null && resolved=yes | |
34 | + env LANG=C grep -q -Fx "$origin" "${DBDIR}/manually_done.list" 2> /dev/null && resolved=yes | |
35 | 35 | pkgtag=`cat "${DBDIR}/moved_from/$origin/pkgtag" 2> /dev/null || :` |
36 | 36 | if [ $opt_batch_mode = no ] |
37 | 37 | then |
@@ -66,11 +66,11 @@ database_query_show_list_failed_conflicts_restoration () | ||
66 | 66 | message_echo "INFO: No item is registered in this list." |
67 | 67 | return 1 |
68 | 68 | fi |
69 | - grep -v -E -f "${DBDIR}/ports_to_delete.grep_pattern_col1" "${DBDIR}/deleted_conflicts" \ | |
69 | + env LANG=C grep -v -E -f "${DBDIR}/ports_to_delete.grep_pattern_col1" "${DBDIR}/deleted_conflicts" \ | |
70 | 70 | | while read origin pkg |
71 | 71 | do |
72 | 72 | pkg_regexp=`str_escape_regexp "$pkg"` |
73 | - against=`grep -E "^$pkg_regexp:" "${DBDIR}/forbidden_conflicts" 2> /dev/null | cut -d : -f 2,3 | sort -u` | |
73 | + against=`env LANG=C grep -E "^$pkg_regexp:" "${DBDIR}/forbidden_conflicts" 2> /dev/null | cut -d : -f 2,3 | sort -u` | |
74 | 74 | if [ $opt_batch_mode = no ] |
75 | 75 | then |
76 | 76 | if [ -n "$pkg" ] |
@@ -256,7 +256,7 @@ database_query_is_default_conf () | ||
256 | 256 | echo "Non-default port options," >> $tmp_msg |
257 | 257 | is_customized=yes |
258 | 258 | fi |
259 | - if grep -q -Fx "$origin" "${DBDIR}/conf/NOPKG:PORTS.parsed" 2> /dev/null | |
259 | + if env LANG=C grep -q -Fx "$origin" "${DBDIR}/conf/NOPKG:PORTS.parsed" 2> /dev/null | |
260 | 260 | then |
261 | 261 | echo "Explicit specification as non-default in ${APPNAME}.conf," >> $tmp_msg |
262 | 262 | is_customized=yes |
@@ -546,7 +546,7 @@ database_query_show_single_list () | ||
546 | 546 | matches_negative=no |
547 | 547 | for negative_listdb in $flag_negative_listdb |
548 | 548 | do |
549 | - if grep -qFx "$origin" "${DBDIR}/$negative_listdb" 2> /dev/null | |
549 | + if env LANG=C grep -qFx "$origin" "${DBDIR}/$negative_listdb" 2> /dev/null | |
550 | 550 | then |
551 | 551 | matches_negative=yes |
552 | 552 | break |
@@ -833,8 +833,8 @@ database_query_exists_in_list () | ||
833 | 833 | list=`ls "${DBDIR}"/fossil_pkgs/fossil_since_* | head -n 1` |
834 | 834 | ;; |
835 | 835 | conflict ) |
836 | - grep -v -E -f "${DBDIR}/ports_to_delete.grep_pattern_col1" "${DBDIR}/deleted_conflicts" 2> /dev/null \ | |
837 | - | grep -q -E "^${origin_esc}[[:space:]]" | |
836 | + env LANG=C grep -v -E -f "${DBDIR}/ports_to_delete.grep_pattern_col1" "${DBDIR}/deleted_conflicts" 2> /dev/null \ | |
837 | + | env LANG=C grep -q -E "^${origin_esc}[[:space:]]" | |
838 | 838 | return |
839 | 839 | ;; |
840 | 840 | taboo ) |
@@ -856,7 +856,7 @@ database_query_exists_in_list () | ||
856 | 856 | list=stage.loop_list/ports_to_delete |
857 | 857 | ;; |
858 | 858 | esac |
859 | - grep -q -Fx "$origin" "${DBDIR}/$list" 2> /dev/null | |
859 | + env LANG=C grep -q -Fx "$origin" "${DBDIR}/$list" 2> /dev/null | |
860 | 860 | } |
861 | 861 | |
862 | 862 | # ============= Check whether the requirements of installed packages match the port configuration ============= |
@@ -870,7 +870,7 @@ database_query_dependency_matching () | ||
870 | 870 | pkg=`database_build_get_new_pkgname "$origin"` |
871 | 871 | [ -n "$pkg" ] || return |
872 | 872 | pkg_info_e "$pkg" || return |
873 | - pkg_info_qr "$pkg" | grep -v '^[[:space:]]*$' | sort -u > $tmp_inst | |
873 | + pkg_info_qr "$pkg" | env LANG=C grep -v '^[[:space:]]*$' | sort -u > $tmp_inst | |
874 | 874 | database_build_get_full_run_requirement_pkgs "$origin" > $tmp_db |
875 | 875 | diff "$tmp_inst" "$tmp_db" > /dev/null 2>/dev/null |
876 | 876 | } |
@@ -883,7 +883,7 @@ database_query_are_requirements_not_locked () | ||
883 | 883 | cat "${DBDIR}/requires/$origin/requirements.all.direct" 2> /dev/null | while read origin_requirement |
884 | 884 | do |
885 | 885 | pkg_requirement=`pkgsys_get_installed_pkg_from_origin "$origin_requirement"` || : |
886 | - if grep -q -Fx "$origin_requirement" "${DBDIR}/freeze.all.list" 2> /dev/null | |
886 | + if env LANG=C grep -q -Fx "$origin_requirement" "${DBDIR}/freeze.all.list" 2> /dev/null | |
887 | 887 | then |
888 | 888 | [ -n "$pkg_requirement" ] || return |
889 | 889 | elif [ -z "$pkg_requirement" ] |
@@ -916,3 +916,21 @@ database_query_initial_orgins () | ||
916 | 916 | fi |
917 | 917 | : |
918 | 918 | } |
919 | + | |
920 | +# ============= Get an unflavored or flavored equivalence of an origin with the same package name, which is deemed the same version ============= | |
921 | +# If the input is unflavored and a flavored equivalence is inspected as a required port, the flavored origin is returned. | |
922 | +# If the input is flavored and an unflavored equivalence is inspected as a required port, the unflavored origin is returned. | |
923 | +# Otherwise, a blank value is returned. | |
924 | +database_query_get_equivalent_orgin () | |
925 | +{ | |
926 | + local origin origin_esc pkg_origin pkg_origin_esc flavor origin_unflavored_esc origin_search | |
927 | + origin=$1 | |
928 | + origin_esc=`str_escape_regexp "$origin"` | |
929 | + pkg_origin=`env LANG=C grep -E "[[:space:]]$origin_esc$" "${DBDIR}/installed_ports:pkg_vs_origin.tbl" | cut -f 2 || :` | |
930 | + [ -n "$pkg_origin" ] || return 0 | |
931 | + pkg_origin_esc=`str_escape_regexp "$pkg_origin"` | |
932 | + flavor=`pkgsys_get_flavor_from_origin "$origin"` | |
933 | + origin_search=$origin_unflavored_esc$ | |
934 | + [ -n "$flavor" ] || origin_search=$origin_esc@ | |
935 | + env LANG=C grep -E "^$pkg_origin_esc[[:space:]]$origin_search" "${DBDIR}/installed_ports:pkg_vs_origin.tbl" | cut -f 2 | head -n 1 || : | |
936 | +} |
@@ -33,7 +33,7 @@ database_record_success () | ||
33 | 33 | { |
34 | 34 | cat "$nodedir/requirements.$dbsuffix" 2> /dev/null |
35 | 35 | [ $level = full ] && cat "$nodedir/ignored_requirements.$tag" 2> /dev/null |
36 | - } | grep -q -Fx -f "${DBDIR}/failed.list" 2> /dev/null | |
36 | + } | env LANG=C grep -q -Fx -f "${DBDIR}/failed.list" 2> /dev/null | |
37 | 37 | then |
38 | 38 | fileedit_rm_a_line "$origin" "${DBDIR}/success.$dbsuffix.list" |
39 | 39 | fileedit_add_a_line_if_new "$origin" "${DBDIR}/todo_after_requirements_succeed.$dbsuffix.list" |
@@ -20,11 +20,11 @@ deinstall_select_leaf_ports_to_delete_dialog () | ||
20 | 20 | do |
21 | 21 | pkgtag=`cat "${DBDIR}/moved_from/$origin/pkgtag" 2> /dev/null` || : |
22 | 22 | val=on |
23 | - grep -Fxq "$origin" "$dst_unselected" 2> /dev/null && val=off | |
23 | + env LANG=C grep -Fxq "$origin" "$dst_unselected" 2> /dev/null && val=off | |
24 | 24 | printf '%s\t"(%s)"\t%s\n' "$origin" "$pkgtag" "$val" |
25 | 25 | done < $src > $itemlist |
26 | 26 | misc_dialog_checklist "$title" "$desc" "$dst_selected" "$itemlist" |
27 | - grep -Fx -v -f "$dst_selected" "$src" > $dst_unselected || : | |
27 | + env LANG=C grep -Fx -v -f "$dst_selected" "$src" > $dst_unselected || : | |
28 | 28 | } |
29 | 29 | |
30 | 30 | # ============= Automatic selection of removing ports ============= |
@@ -41,11 +41,11 @@ deinstall_select_auto () | ||
41 | 41 | cat "$dst_add" "$dst_rem" 2> /dev/null | sort -u > $tmp_srcprev |
42 | 42 | cat "$src" 2> /dev/null | sort -u > $tmp_srcnew |
43 | 43 | fileedit_manipulate_old_new_lines "$tmp_srcprev" "$tmp_srcnew" "$diff_removed" "$diff_added" || return 0 |
44 | - grep -v -Fx -f "$diff_removed" "$dst_rem" 2> /dev/null | \ | |
45 | - grep -Fx -f "$src" > $dst_rem.tmp || : | |
44 | + env LANG=C grep -v -Fx -f "$diff_removed" "$dst_rem" 2> /dev/null | \ | |
45 | + env LANG=C grep -Fx -f "$src" > $dst_rem.tmp || : | |
46 | 46 | mv "$dst_rem.tmp" "$dst_rem" |
47 | 47 | cat "$dst_add" "$diff_added" 2> /dev/null | sort -u | \ |
48 | - grep -Fx -f "$src" > $dst_add.tmp || : | |
48 | + env LANG=C grep -Fx -f "$src" > $dst_add.tmp || : | |
49 | 49 | mv "$dst_add.tmp" "$dst_add" |
50 | 50 | } |
51 | 51 |
@@ -109,11 +109,11 @@ deinstall_select_obsolete_ports_to_delete_dialog () | ||
109 | 109 | do |
110 | 110 | pkgtag=`cat "${DBDIR}/initial/$origin/installed_version"` |
111 | 111 | val=on |
112 | - grep -Fxq "$origin" "$dst_unselected" 2> /dev/null && val=off | |
112 | + env LANG=C grep -Fxq "$origin" "$dst_unselected" 2> /dev/null && val=off | |
113 | 113 | printf '%s\t"(%s)"\t%s\n' "$origin" "$pkgtag" "$val" |
114 | 114 | done < $src > $itemlist |
115 | 115 | misc_dialog_checklist "$title" "$desc" "$dst_selected" "$itemlist" |
116 | - grep -Fx -v -f "$dst_selected" "$src" > $dst_unselected || : | |
116 | + env LANG=C grep -Fx -v -f "$dst_selected" "$src" > $dst_unselected || : | |
117 | 117 | } |
118 | 118 | |
119 | 119 | # ============= Selection of removing obsolete ports ============= |
@@ -217,7 +217,7 @@ deinstall_exec () | ||
217 | 217 | for origin in `{ echo "$origin_master"; database_query_initial_orgins "$origin_master"; } | sort -u` |
218 | 218 | do |
219 | 219 | origin_regexp=`str_escape_regexp "$origin"` |
220 | - grep -v -E "^${origin_regexp}[[:space:]]" "${DBDIR}/deleted_conflicts" > ${DBDIR}/deleted_conflicts.tmp 2> /dev/null || : | |
220 | + env LANG=C grep -v -E "^${origin_regexp}[[:space:]]" "${DBDIR}/deleted_conflicts" > ${DBDIR}/deleted_conflicts.tmp 2> /dev/null || : | |
221 | 221 | mv "${DBDIR}/deleted_conflicts.tmp" "${DBDIR}/deleted_conflicts" |
222 | 222 | currentpkg=`pkgsys_get_installed_pkg_from_origin "$origin" | tr '\n' ' ' | sed 's/ *$//'` |
223 | 223 | [ -n "$currentpkg" ] || continue |
@@ -248,7 +248,7 @@ deinstall_exec () | ||
248 | 248 | backup_pkgdir=${PKGREPOSITORY} |
249 | 249 | fi |
250 | 250 | mkdir -p "$backup_pkgdir" |
251 | - pkg=`echo "$currentpkg" | tr ' ' '\n' | grep -v '^$' | tail -n 1` | |
251 | + pkg=`echo "$currentpkg" | tr ' ' '\n' | env LANG=C grep -v '^$' | tail -n 1` | |
252 | 252 | backup_pkg=`pkgsys_create_backup_pkg "$pkg" "$backup_pkgdir"` || : |
253 | 253 | if [ -n "$backup_pkg" ] |
254 | 254 | then |
@@ -260,7 +260,7 @@ deinstall_exec () | ||
260 | 260 | fi |
261 | 261 | fi |
262 | 262 | message_echo "-- (Deleting package for $origin as $currentpkg)" |
263 | - echo "$currentpkg" | tr ' ' '\n' | grep -v '^$' | while read pkg | |
263 | + echo "$currentpkg" | tr ' ' '\n' | env LANG=C grep -v '^$' | while read pkg | |
264 | 264 | do |
265 | 265 | if ! pkg_delete_f "$currentpkg" |
266 | 266 | then |
@@ -15,7 +15,7 @@ fileedit_rm_a_line () | ||
15 | 15 | [ -n "$item" ] || return 0 |
16 | 16 | [ -e "$dstpath" ] || return 0 |
17 | 17 | tmpfile=$dstpath.fileedit_rm_a_line.tmp |
18 | - grep -v -Fx "$item" "$dstpath" 2> /dev/null > $tmpfile || : | |
18 | + env LANG=C grep -v -Fx "$item" "$dstpath" 2> /dev/null > $tmpfile || : | |
19 | 19 | mv "$tmpfile" "$dstpath" |
20 | 20 | } |
21 | 21 |
@@ -31,7 +31,7 @@ fileedit_add_a_line_if_new () | ||
31 | 31 | if [ -e "$dstpath" ] |
32 | 32 | then |
33 | 33 | cp "$dstpath" "$tmpfile" |
34 | - grep -q -Fx "$item" "$dstpath" \ | |
34 | + env LANG=C grep -q -Fx "$item" "$dstpath" \ | |
35 | 35 | || echo "$item" >> $tmpfile |
36 | 36 | else |
37 | 37 | dstdir=`dirname "$dstpath"` |
@@ -77,7 +77,7 @@ fileedit_add_lines_if_new () | ||
77 | 77 | then |
78 | 78 | while read origin |
79 | 79 | do |
80 | - grep -q -Fx "$origin" "$dstpath" \ | |
80 | + env LANG=C grep -q -Fx "$origin" "$dstpath" \ | |
81 | 81 | || echo "$origin" |
82 | 82 | done > $tmpclip |
83 | 83 | if [ "@$advance" = @advance ] |
@@ -110,8 +110,8 @@ fileedit_manipulate_old_new_lines () | ||
110 | 110 | newdiff=$4 |
111 | 111 | [ -e "$oldsrc" ] || oldsrc=/dev/null |
112 | 112 | [ -e "$newsrc" ] || newsrc=/dev/null |
113 | - grep -vFx -f "$newsrc" "$oldsrc" > $olddiff 2> /dev/null || : | |
114 | - grep -vFx -f "$oldsrc" "$newsrc" > $newdiff 2> /dev/null || : | |
113 | + env LANG=C grep -vFx -f "$newsrc" "$oldsrc" > $olddiff 2> /dev/null || : | |
114 | + env LANG=C grep -vFx -f "$oldsrc" "$newsrc" > $newdiff 2> /dev/null || : | |
115 | 115 | [ `cat "$olddiff" "$newdiff" | wc -l` -gt 0 ] |
116 | 116 | } |
117 | 117 |
@@ -123,7 +123,7 @@ fileedit_manipulate_old_lines () | ||
123 | 123 | newsrc=$2 |
124 | 124 | [ -e "$oldsrc" ] || oldsrc=/dev/null |
125 | 125 | [ -e "$newsrc" ] || newsrc=/dev/null |
126 | - grep -vFx -f "$newsrc" "$oldsrc" 2> /dev/null | |
126 | + env LANG=C grep -vFx -f "$newsrc" "$oldsrc" 2> /dev/null | |
127 | 127 | } |
128 | 128 | |
129 | 129 | # ============= Manipulate new lines from an old and a new versions of a file ============= |
@@ -134,7 +134,7 @@ fileedit_manipulate_new_lines () | ||
134 | 134 | newsrc=$2 |
135 | 135 | [ -e "$oldsrc" ] || oldsrc=/dev/null |
136 | 136 | [ -e "$newsrc" ] || newsrc=/dev/null |
137 | - grep -vFx -f "$oldsrc" "$newsrc" 2> /dev/null | |
137 | + env LANG=C grep -vFx -f "$oldsrc" "$newsrc" 2> /dev/null | |
138 | 138 | } |
139 | 139 | |
140 | 140 | # ============= Check whether removed lines exists in updating from an old and a new versions of a file ============= |
@@ -145,5 +145,5 @@ fileedit_exists_old_lines () | ||
145 | 145 | newsrc=$2 |
146 | 146 | [ -e "$oldsrc" ] || oldsrc=/dev/null |
147 | 147 | [ -e "$newsrc" ] || newsrc=/dev/null |
148 | - grep -qvFx -f "$newsrc" "$oldsrc" 2> /dev/null | |
148 | + env LANG=C grep -qvFx -f "$newsrc" "$oldsrc" 2> /dev/null | |
149 | 149 | } |
@@ -152,14 +152,17 @@ fs_get_actual_mount_point_pattern () | ||
152 | 152 | # ============= Get mount info at the descendant directory levels required for builder chroot environment ============= |
153 | 153 | fs_get_descendant_mount_info () |
154 | 154 | { |
155 | - local mountpoint mountpoint_real_regexp basedir | |
155 | + local mountpoint mountpoint_real_regexp basedir basedir_ptn zpools_ptn ptns | |
156 | 156 | mountpoint=$1 |
157 | 157 | mountpoint_real_regexp=`fs_get_actual_mount_point_pattern "$mountpoint"` || return |
158 | 158 | basedir=`fs_get_system_basedir` |
159 | 159 | basedir_ptn=`str_escape_regexp "$basedir"` |
160 | - df | sed 1d | grep -E "%[[:space:]]+$mountpoint_real_regexp\/" | while read fs data | |
160 | + zpools_ptn=`zpool list -H -o name | str_escape_regexp_filter | tr \\n '|' | sed 's/|$//'` | |
161 | + ptns='/|<above>:' | |
162 | + [ -z "$zpools_ptn" ] || ptns="$ptns|$zpools_ptn" | |
163 | + df | sed 1d | env LANG=C grep -E "%[[:space:]]+$mountpoint_real_regexp\/" | while read fs data | |
161 | 164 | do |
162 | - echo "$fs" | grep -q -e '^/' -e '^<above>:' && fs=normal | |
165 | + echo "$fs" | env LANG=C grep -Eq "^$ptns" && fs=normal | |
163 | 166 | mp_abs=`echo "$data" | sed -E 's|.*%[[:space:]]+(/.+)$|\1|'` |
164 | 167 | mp=`echo "$mp_abs" | sed -E "s|^$basedir_ptn||"` |
165 | 168 | relative=`echo "$mp_abs" | sed -E "s|^$mountpoint_real_regexp||"` |
@@ -186,7 +189,7 @@ fs_fix_unionfs_image_if_hidden () | ||
186 | 189 | needlepath_cur=$needlepath_next |
187 | 190 | done |
188 | 191 | [ -e "$needlepath" ] && return |
189 | - if [ -n "$needlepath_lowest_exist" ] && df "$needlepath_lowest_exist" | sed 1d | grep -q '^<above>:' | |
192 | + if [ -n "$needlepath_lowest_exist" ] && df "$needlepath_lowest_exist" | sed 1d | env LANG=C grep -q '^<above>:' | |
190 | 193 | then |
191 | 194 | message_echo "ERROR: Failed to recover a lost mandatory file, probably due to the bug of unionfs: $needlepath" >&2 |
192 | 195 | mkdir -p "${DBDIR}/execflag" |
@@ -206,19 +209,19 @@ fs_chk_mounted () | ||
206 | 209 | mountpoint=`str_regularize_df_path "$3"` |
207 | 210 | target_ptn=`str_escape_regexp "$target"` |
208 | 211 | mountpoint_real_regexp=`str_escape_regexp "$mountpoint"` |
209 | - tmpsrc=`df | sed 1d | grep -E "%[[:space:]]+$mountpoint_real_regexp$"` | |
212 | + tmpsrc=`df | sed 1d | env LANG=C grep -E "%[[:space:]]+$mountpoint_real_regexp$"` | |
210 | 213 | case $type in |
211 | 214 | nullfs ) |
212 | - echo "$tmpsrc" | grep -qE "^${target_ptn}[[:space:]]" && return | |
215 | + echo "$tmpsrc" | env LANG=C grep -qE "^${target_ptn}[[:space:]]" && return | |
213 | 216 | ;; |
214 | 217 | unionfs ) |
215 | - echo "$tmpsrc" | grep -qE "^<above>:${target_ptn}[[:space:]]" && return | |
218 | + echo "$tmpsrc" | env LANG=C grep -qE "^<above>:${target_ptn}[[:space:]]" && return | |
216 | 219 | ;; |
217 | 220 | devfs | fdescfs | procfs | linprocfs | tmpfs ) |
218 | - echo "$tmpsrc" | grep -q "^$type" && return | |
221 | + echo "$tmpsrc" | env LANG=C grep -q "^$type" && return | |
219 | 222 | ;; |
220 | 223 | *) |
221 | - message_echo "ERROR: Unsupported fyle system [$type]" >&2 | |
224 | + message_echo "ERROR: Unsupported file system [$type]" >&2 | |
222 | 225 | exit 1 |
223 | 226 | ;; |
224 | 227 | esac |
@@ -13,7 +13,7 @@ main_set_version () | ||
13 | 13 | COMPATIBLE_VERSIONS='^(4\.[1]\.[0-9])$' |
14 | 14 | # Template for development versions |
15 | 15 | MYVERSION=4.1.0+toward_4.1.1_20211011024526 |
16 | - COMPATIBLE_VERSIONS='^(4\.[0-1]\.[0-9]]|4\.[0]\.[0]+(|\+toward_4\.[0-1]\.[0-9]+_[0-9]+))$' | |
16 | + COMPATIBLE_VERSIONS='^(4\.[0-1]\.[0-9]]|4\.[0-1]\.[0]+(|\+toward_4\.[0-1]\.[0-9]+_[0-9]+))$' | |
17 | 17 | } |
18 | 18 | |
19 | 19 | # ============= Parse options, arguments and control parameters ============= |
@@ -523,7 +523,7 @@ main_reflect_conf_changes () | ||
523 | 523 | if fileedit_manipulate_old_new_lines \ |
524 | 524 | "${DBDIR}/conf.prev/setenv.sh" "${DBDIR}/conf/setenv.sh" "$tmpfile_old" "$tmpfile_new" |
525 | 525 | then |
526 | - if grep -q -e ^LOCALBASE= -e ^LINUXBASE= -e ^PORTSDIR= "$tmpfile_old" "$tmpfile_new" | |
526 | + if env LANG=C grep -q -e ^LOCALBASE= -e ^LINUXBASE= -e ^PORTSDIR= "$tmpfile_old" "$tmpfile_new" | |
527 | 527 | then |
528 | 528 | message_echo "ERROR: Migration of the temporary database is unavailable because LOCALBASE, LINUXBASE or PORTSDIR was changed." >&2 |
529 | 529 | message_echo " ${APPNAME} clean" >&2 |
@@ -56,7 +56,7 @@ misc_get_all_vardefs () | ||
56 | 56 | # ============= Initialize shell variable definitions ============= |
57 | 57 | misc_init_vardefs () |
58 | 58 | { |
59 | - eval `misc_get_all_vardefs | grep -E '^[a-z_][a-zA-Z0-9_]+=' | sed 's/=.*//;s/^/unset /'` | |
59 | + eval `misc_get_all_vardefs | env LANG=C grep -E '^[a-z_][a-zA-Z0-9_]+=' | sed 's/=.*//;s/^/unset /'` | |
60 | 60 | } |
61 | 61 | |
62 | 62 | # ============= Get the size of the current console ============= |
@@ -12,7 +12,7 @@ OPTIONS_SHIFT=0 | ||
12 | 12 | |
13 | 13 | # ============= Database of options which are given at each run and not saved ============= |
14 | 14 | # [Syntax of option databases] |
15 | -# short_name, long_name, variable, defult_vaule, set_value | |
15 | +# short_name, long_name, variable, default_value, set_value | |
16 | 16 | # Columns are delimited by tab characters. |
17 | 17 | options_db_onetime () |
18 | 18 | { |
@@ -48,9 +48,44 @@ options_db_saved_and_non_renewable () | ||
48 | 48 | eof |
49 | 49 | } |
50 | 50 | |
51 | + | |
52 | +# ============= Definitions of value regulator functions ============= | |
53 | +options_db_value_regulators () | |
54 | +{ | |
55 | + cat << eof | |
56 | +eof | |
57 | +} | |
58 | + | |
51 | 59 | # ============= Regularize the option value ============= |
52 | 60 | options_regularize () |
53 | 61 | { |
62 | + local nlines iline srcline var fnc | |
63 | + options_db_value_regulators > ${TMPDIR}/options_regularize::db | |
64 | + nlines=`wc -l < ${TMPDIR}/options_regularize::db` | |
65 | + iline=1 | |
66 | + while [ $iline -le $nlines ] | |
67 | + do | |
68 | + srcline=`sed -n ${iline}p "${TMPDIR}/options_regularize::db"` | |
69 | + var=`echo "$srcline" | cut -f 1` | |
70 | + fnc=`echo "$srcline" | cut -f 2` | |
71 | + eval $var=\`$fnc \"\$$var\"\` | |
72 | + iline=$(($iline+1)) | |
73 | + done | |
74 | +} | |
75 | + | |
76 | +# ============= Regularize a value of an option value ============= | |
77 | +options_regularize_a_value () | |
78 | +{ | |
79 | + local variable value fnc | |
80 | + variable=$1 | |
81 | + value=$2 | |
82 | + fnc=`options_db_value_regulators | grep "^$variable[[:space:]]" | cut -f 2` | |
83 | + if [ -n "$fnc" ] | |
84 | + then | |
85 | + eval $fnc "$value" | |
86 | + else | |
87 | + echo "$value" | |
88 | + fi | |
54 | 89 | } |
55 | 90 | |
56 | 91 | # ============= Database of all options to be saved ============= |
@@ -114,7 +149,7 @@ options_convert_shortname_to_varname () | ||
114 | 149 | { |
115 | 150 | local shortname |
116 | 151 | shortname=$1 |
117 | - options_db_all | grep -m 1 "^${shortname}[[:space:]]" | cut -f 3 | sort -u | |
152 | + options_db_all | env LANG=C grep -m 1 "^${shortname}[[:space:]]" | cut -f 3 | sort -u | |
118 | 153 | } |
119 | 154 | |
120 | 155 | # ============= Dump all command line arguments and options ============= |
@@ -144,7 +179,7 @@ options_set_default () | ||
144 | 179 | # ============= Get the argument for getopts ============= |
145 | 180 | options_getopts_arg () |
146 | 181 | { |
147 | - options_db_all | cut -f 1,5 | grep -v '^[[:space:]]' | sort -u \ | |
182 | + options_db_all | cut -f 1,5 | env LANG=C grep -v '^[[:space:]]' | sort -u \ | |
148 | 183 | | sed -E 's/[[:space:]]:$/:/;s/[[:space:]].*$//' | tr -d '\n' |
149 | 184 | } |
150 | 185 |
@@ -157,7 +192,7 @@ options_getopts_only_short () | ||
157 | 192 | while getopts $getopts_option option > /dev/null |
158 | 193 | do |
159 | 194 | val=`str_escape_replaceval "$OPTARG"` |
160 | - command=`options_db_all | grep -m 1 "^${option}[[:space:]]" \ | |
195 | + command=`options_db_all | env LANG=C grep -m 1 "^${option}[[:space:]]" \ | |
161 | 196 | | cut -f 3,5 | sed -E 's/[[:space:]]/=/;s/:$/'$val'/' || :` |
162 | 197 | [ -n "$command" ] || return 1 |
163 | 198 | echo -n "$command;OPTIND=$OPTIND;" |
@@ -182,7 +217,7 @@ options_getopts () | ||
182 | 217 | [ $# -eq 0 ] && break |
183 | 218 | erropt=$1 |
184 | 219 | option=`expr "x$1" : '^x--\([a-zA-Z0-9][a-zA-Z0-9-]*\).*'` || break |
185 | - command=`options_db_all | cut -f 2,3,5 | grep -m 1 "^${option}[[:space:]]" \ | |
220 | + command=`options_db_all | cut -f 2,3,5 | env LANG=C grep -m 1 "^${option}[[:space:]]" \ | |
186 | 221 | | cut -f 2,3 | sed -E 's/[[:space:]]/=/' || :` |
187 | 222 | [ -n "$command" ] || break |
188 | 223 | if expr "$command" : '^[^=]*=:$' > /dev/null |
@@ -208,21 +243,23 @@ options_getopts () | ||
208 | 243 | # ============= Filter option value definitions to pick up selected groups ============= |
209 | 244 | options_filter () |
210 | 245 | { |
211 | - grep `options_db "$@" | cut -f 3 | sed 's/^/-e ^/;s/$/=/'` | |
246 | + env LANG=C grep `options_db "$@" | cut -f 3 | sed 's/^/-e ^/;s/$/=/'` | |
212 | 247 | } |
213 | 248 | |
214 | 249 | # ============= Compose an option set in a command line form from the current settings ============= |
215 | 250 | options_inverse_parse () |
216 | 251 | { |
217 | - options_db "$@" | while read short_name long_name variable defult_vaule set_value | |
252 | + options_db "$@" | while read short_name long_name variable default_value set_value | |
218 | 253 | do |
254 | + eval default_value_eval=$default_value | |
255 | + default_value_regular=`options_regularize_a_value "$variable" "$default_value_eval"` | |
219 | 256 | eval val=\$$variable |
220 | - eval val_def=$defult_vaule | |
257 | + eval val_def=\$default_value_regular | |
221 | 258 | eval val_set=$set_value |
222 | 259 | if [ "x$set_value" = x: ] |
223 | 260 | then |
224 | 261 | [ "x$val" = "x$val_def" ] \ |
225 | - || misc_get_all_vardefs | grep -m 1 "^$variable=" \ | |
262 | + || misc_get_all_vardefs | env LANG=C grep -m 1 "^$variable=" \ | |
226 | 263 | | sed "s/^[^=]*=/-$short_name /" |
227 | 264 | elif [ "x$val" = "x$val_set" ] |
228 | 265 | then |
@@ -237,13 +274,15 @@ options_filter_configured () | ||
237 | 274 | { |
238 | 275 | local tmpptn |
239 | 276 | tmpptn=${TMPDIR}/options_filter_configured:ptn |
240 | - options_db "$@" | while read short_name long_name variable defult_vaule set_value | |
277 | + options_db "$@" | while read short_name long_name variable default_value set_value | |
241 | 278 | do |
279 | + eval default_value_eval=$default_value | |
280 | + default_value_regular=`options_regularize_a_value "$variable" "$default_value_eval"` | |
242 | 281 | eval val=\$$variable |
243 | - eval val_def=$defult_vaule | |
282 | + eval val_def=\$default_value_regular | |
244 | 283 | [ "x$val" = "x$val_def" ] || echo "^$variable=" |
245 | 284 | done > $tmpptn |
246 | - grep -f "$tmpptn" | |
285 | + env LANG=C grep -f "$tmpptn" | |
247 | 286 | } |
248 | 287 | |
249 | 288 | # ============= Check inclusion of invalid options intending to be renewed ============= |
@@ -298,7 +337,7 @@ options_select_new_ports_if_duplicated () | ||
298 | 337 | itemlist=${TMPDIR}/options_select_new_ports_if_duplicated::itemlist |
299 | 338 | cp /dev/null "$dstfile.tmp" |
300 | 339 | echo "$optargs" | sed -E 's/[ :]+/\ |
301 | -/g' | grep -v '^$' | sort -u > $globs_list | |
340 | +/g' | env LANG=C grep -v '^$' | sort -u > $globs_list | |
302 | 341 | nlines=`wc -l < $globs_list` |
303 | 342 | iline=1 |
304 | 343 | while [ $iline -le $nlines ] |
@@ -318,7 +357,7 @@ options_select_new_ports_if_duplicated () | ||
318 | 357 | do |
319 | 358 | if pkgsys_exists_or_existed_from_orig "$origin" \ |
320 | 359 | || cat "${DBDIR}/installed_ports" "${DBDIR}/targets_specified_so_far" 2> /dev/null \ |
321 | - | grep -q -Fx "$origin" | |
360 | + | env LANG=C grep -q -Fx "$origin" | |
322 | 361 | then |
323 | 362 | echo "$origin" >> $tmp_existing_ports |
324 | 363 | else |
@@ -229,7 +229,7 @@ pkgsys_fetch_legacy_remote () | ||
229 | 229 | pkg_regexp=`str_escape_regexp "$pkg"` |
230 | 230 | pkgsys_ready_checksum_file || return |
231 | 231 | checksumpath=`pkgsys_ready_checksum_file__fetched_file` |
232 | - validMD5=`grep -m 1 -E -e "^MD5[[:space:]]*\($pkg_regexp\.tbz\)[[:space:]]*=" "$checksumpath" | sed -E "s/^[^=]*=[[:space:]]*(.*)/\1/"` | |
232 | + validMD5=`env LANG=C grep -m 1 -E -e "^MD5[[:space:]]*\($pkg_regexp\.tbz\)[[:space:]]*=" "$checksumpath" | sed -E "s/^[^=]*=[[:space:]]*(.*)/\1/"` | |
233 | 233 | if [ -z "$validMD5" ] |
234 | 234 | then |
235 | 235 | message_echo "WARNING: No check sum for $pkg.tbz." >&2 |
@@ -297,7 +297,7 @@ pkgsys_is_dependency_of_a_legacypkg_latest () | ||
297 | 297 | rm -rf "$tmp_extract" |
298 | 298 | mkdir "$tmp_extract" |
299 | 299 | tar xf "$pkgarc" -C "$tmp_extract" +CONTENTS |
300 | - grep -e '^@pkgdep[[:space:]]' -e '^@comment[[:space:]]*DEPORIGIN:' "$tmp_extract/+CONTENTS" \ | |
300 | + env LANG=C grep -e '^@pkgdep[[:space:]]' -e '^@comment[[:space:]]*DEPORIGIN:' "$tmp_extract/+CONTENTS" \ | |
301 | 301 | | sed 's/^@pkgdep[[:space:]]*//;s/^@comment[[:space:]]*DEPORIGIN://' > $tmp_contents |
302 | 302 | nlines=`wc -l < $tmp_contents` |
303 | 303 | iline=1 |
@@ -442,7 +442,7 @@ pkgsys_def_pkgtools () | ||
442 | 442 | { |
443 | 443 | local glob_unflavored |
444 | 444 | glob_unflavored=$1 |
445 | - pkg query -g '%At\t%Av' "$glob_unflavored" 2> /dev/null | grep -E '^flavor[[:space:]]' | cut -f 2 | |
445 | + pkg query -g '%At\t%Av' "$glob_unflavored" 2> /dev/null | env LANG=C grep -E '^flavor[[:space:]]' | cut -f 2 | |
446 | 446 | } |
447 | 447 | pkg_info_flavored_origin () |
448 | 448 | { |
@@ -457,9 +457,9 @@ pkgsys_def_pkgtools () | ||
457 | 457 | { |
458 | 458 | local tmp_flavored tmp_flavored_ptn |
459 | 459 | tmp_flavored_ptn=${TMPDIR}/pkg_info_all_flavored_origins:flavored_ptn |
460 | - pkg query '%o\t%At\t%Av' 2> /dev/null | grep -E '^[^[:space:]]+[[:space:]]flavor[[:space:]]' | cut -f 1,3 | tr '\t' @ | sed 's/@$//' | |
461 | - pkg query '%n\t%At' 2> /dev/null | grep -E '^[^[:space:]]+[[:space:]]flavor$' | cut -f 1 > $tmp_flavored_ptn | |
462 | - pkg query '%n\t%o' 2> /dev/null | grep -vFx -f "$tmp_flavored_ptn" | cut -f 2 | |
460 | + pkg query '%o\t%At\t%Av' 2> /dev/null | env LANG=C grep -E '^[^[:space:]]+[[:space:]]flavor[[:space:]]' | cut -f 1,3 | tr '\t' @ | sed 's/@$//' | |
461 | + pkg query '%n\t%At' 2> /dev/null | env LANG=C grep -E '^[^[:space:]]+[[:space:]]flavor$' | cut -f 1 > $tmp_flavored_ptn | |
462 | + pkg query '%n\t%o' 2> /dev/null | env LANG=C grep -vFx -f "$tmp_flavored_ptn" | cut -f 2 | |
463 | 463 | } |
464 | 464 | pkg_check_sanity () |
465 | 465 | { |
@@ -469,9 +469,9 @@ pkgsys_def_pkgtools () | ||
469 | 469 | tmp_stderr=${TMPDIR}/pkgng:pkg_check_sanity:stderr |
470 | 470 | pkg check -s "$pkg" > $tmp_stdout 2> $tmp_stderr || : |
471 | 471 | { |
472 | - grep '^[^:]*: checksum mismatch for ' "$tmp_stderr" | sed 's/^[^:]*: checksum mismatch for //' || : | |
473 | - grep '^[^:]*: missing file ' "$tmp_stderr" | sed 's/^[^:]*: missing file //' || : | |
474 | - if grep -q '^pkg: .*: No such file or directory$' "$tmp_stderr" # For the old specification of pkg(8) | |
472 | + env LANG=C grep '^[^:]*: checksum mismatch for ' "$tmp_stderr" | sed 's/^[^:]*: checksum mismatch for //' || : | |
473 | + env LANG=C grep '^[^:]*: missing file ' "$tmp_stderr" | sed 's/^[^:]*: missing file //' || : | |
474 | + if env LANG=C grep -q '^pkg: .*: No such file or directory$' "$tmp_stderr" # For the old specification of pkg(8) | |
475 | 475 | then |
476 | 476 | pkg info -ql "$pkg" 2> /dev/null | while read filepath |
477 | 477 | do |
@@ -720,16 +720,16 @@ pkgsys_def_pkgtools () | ||
720 | 720 | PKGNG_AUTODEPS=NO |
721 | 721 | PKGNG_PORTAUDIT_SITE='http=//portaudit.FreeBSD.org/auditfile.tbz' |
722 | 722 | # Load configuration for pkg(1) |
723 | - pkg_conf=`pkg query %Fp pkg 2> /dev/null | grep '/etc/pkg\.conf\.sample$' | sed 's/\.sample$//'` || : | |
723 | + pkg_conf=`pkg query %Fp pkg 2> /dev/null | env LANG=C grep '/etc/pkg\.conf\.sample$' | sed 's/\.sample$//'` || : | |
724 | 724 | [ -n "$pkg_conf" ] || pkg_conf=${MYPREFIX}/etc/pkg.conf |
725 | - grep -v -e '^[[:space:]]*#' -e '^[[:space:]]*$' "$pkg_conf" 2> /dev/null \ | |
726 | - | grep -e '^[[:space:]]*[A-Z0-9_]*[[:space:]]*:[[:space:]]*.*' \ | |
725 | + env LANG=C grep -v -e '^[[:space:]]*#' -e '^[[:space:]]*$' "$pkg_conf" 2> /dev/null \ | |
726 | + | env LANG=C grep -e '^[[:space:]]*[A-Z0-9_]*[[:space:]]*:[[:space:]]*.*' \ | |
727 | 727 | | while read srcline |
728 | 728 | do |
729 | 729 | var=`expr "$srcline" : '^[[:space:]]*\([A-Z0-9_]*\)[[:space:]]*:.*'` || : |
730 | 730 | val=`expr "$srcline" : '^[[:space:]]*[A-Z0-9_]*[[:space:]]*:[[:space:]]*\(.*\)'` || : |
731 | 731 | eval PKGNG_$var=\$val |
732 | - misc_get_all_vardefs | grep "^PKGNG_$var=" | |
732 | + misc_get_all_vardefs | env LANG=C grep "^PKGNG_$var=" | |
733 | 733 | done > ${TMPDIR}/pkgsys_def_pkgtools:pkg.conf.sh |
734 | 734 | . "${TMPDIR}/pkgsys_def_pkgtools:pkg.conf.sh" |
735 | 735 | } |
@@ -746,10 +746,10 @@ pkgsys_def_pkgtools () | ||
746 | 746 | message_echo "INFO: Installing pkgng by legacy package tool." |
747 | 747 | checksumpath=`pkgsys_ready_checksum_file__fetched_file` |
748 | 748 | pkgname=`sed 's/^MD5[[:space:]]*(//;s/\.tbz)[[:space:]]*=[^=]*$//' "$checksumpath" \ |
749 | - | grep -m 1 '^pkg-[0-9]'` || : | |
749 | + | env LANG=C grep -m 1 '^pkg-[0-9]'` || : | |
750 | 750 | [ -n "$pkgname" ] && pkg_inst_remote_wild "$pkgname" && return |
751 | 751 | message_echo "INFO: Failed by package, so installing pkgng by port." |
752 | - grep -Ev '^[[:space:]]*WITH_PKG(|NG)=' /etc/make.conf > ${TMPDIR}/make.conf 2> /dev/null || : | |
752 | + env LANG=C grep -Ev '^[[:space:]]*WITH_PKG(|NG)=' /etc/make.conf > ${TMPDIR}/make.conf 2> /dev/null || : | |
753 | 753 | echo WITHOUT_PKG=yes >> ${TMPDIR}/make.conf |
754 | 754 | echo WITHOUT_PKGNG=yes >> ${TMPDIR}/make.conf |
755 | 755 | dev_out=/dev/stdout |
@@ -851,7 +851,7 @@ pkgsys_def_pkgtools () | ||
851 | 851 | } |
852 | 852 | pkg_info_qR () |
853 | 853 | { |
854 | - pkg_info -qR "$@" 2> /dev/null | grep -v '^$' | |
854 | + pkg_info -qR "$@" 2> /dev/null | env LANG=C grep -v '^$' | |
855 | 855 | } |
856 | 856 | pkg_info_Ex () |
857 | 857 | { |
@@ -1123,6 +1123,7 @@ pkgsys_get_installed_pkg_from_glob () | ||
1123 | 1123 | local glob regexp |
1124 | 1124 | for glob in "$@" |
1125 | 1125 | do |
1126 | + [ -z "$glob" ] && continue | |
1126 | 1127 | if regexp=`expr "$glob" : ':\(.*\)'` |
1127 | 1128 | then |
1128 | 1129 | pkg_info_Ex "$regexp" |
@@ -1158,7 +1159,7 @@ pkgsys_exists_or_existed_from_orig () | ||
1158 | 1159 | local origin |
1159 | 1160 | origin=$1 |
1160 | 1161 | cut -f 2 "${DBDIR}/installed_ports:pkg_vs_origin.tbl" 2> /dev/null \ |
1161 | - | grep -q -Fx "$origin" || pkgsys_exists_from_orig "$origin" | |
1162 | + | env LANG=C grep -q -Fx "$origin" || pkgsys_exists_from_orig "$origin" | |
1162 | 1163 | } |
1163 | 1164 | |
1164 | 1165 | # ============= Get the name of an initially installed package for a flavored origin ============= |
@@ -1221,7 +1222,7 @@ pkgsys_init_pkg_orig_by_ambiguous_matching () | ||
1221 | 1222 | while : |
1222 | 1223 | do |
1223 | 1224 | pkg_regexp=`str_escape_regexp "$pkg"`$ambsuffix |
1224 | - grep -E "^${pkg_regexp}[[:space:]]" "${DBDIR}/installed_ports:pkg_vs_origin.tbl" 2> /dev/null \ | |
1225 | + env LANG=C grep -E "^${pkg_regexp}[[:space:]]" "${DBDIR}/installed_ports:pkg_vs_origin.tbl" 2> /dev/null \ | |
1225 | 1226 | | cut -f 2 > $tmporigin |
1226 | 1227 | norigins=`wc -l < $tmporigin` |
1227 | 1228 | [ $norigins -gt 0 ] && break |
@@ -1298,23 +1299,23 @@ pkgsys_eval_ports_glob () | ||
1298 | 1299 | glob_regexp_unflavored=`expr "$glob_regexp" : '\([^@]*\)' || :`$ |
1299 | 1300 | glob_regexp_flavor=^`expr "$glob_regexp" : '[^@]*@\([^@]*\)' || :` |
1300 | 1301 | |
1301 | - grep -E "$glob_regexp_unflavored" "$unflavored_origlist" 2>&1 | while read origin_unflavored | |
1302 | + env LANG=C grep -E "$glob_regexp_unflavored" "$unflavored_origlist" 2>&1 | while read origin_unflavored | |
1302 | 1303 | do |
1303 | 1304 | fs_fix_unionfs_image_if_hidden "${PORTSDIR}/$origin_unflavored" |
1304 | 1305 | make -C "${PORTSDIR}/$origin_unflavored" -V FLAVORS 2> /dev/null | \ |
1305 | - tr '[:space:]' '\n' | grep -v '^$' | grep -E "$glob_regexp_flavor" | sed -E "s|^|$origin_unflavored@|" | |
1306 | + tr '[:space:]' '\n' | env LANG=C grep -v '^$' | env LANG=C grep -E "$glob_regexp_flavor" | sed -E "s|^|$origin_unflavored@|" | |
1306 | 1307 | done |
1307 | 1308 | { |
1308 | 1309 | pkg_info_all_flavored_origins |
1309 | 1310 | cut -f 2 "${DBDIR}/installed_ports:pkg_vs_origin.tbl" 2> /dev/null |
1310 | - } | grep -E "$glob_regexp" 2>&1 || : | |
1311 | + } | env LANG=C grep -E "$glob_regexp" 2>&1 || : | |
1311 | 1312 | else |
1312 | - grep -E "$glob_regexp" "$unflavored_origlist" 2>&1 | while read origin_unflavored | |
1313 | + env LANG=C grep -E "$glob_regexp" "$unflavored_origlist" 2>&1 | while read origin_unflavored | |
1313 | 1314 | do |
1314 | 1315 | origin_unflavored_rpl=`str_escape_replaceval "$origin_unflavored"` |
1315 | 1316 | fs_fix_unionfs_image_if_hidden "${PORTSDIR}/$origin_unflavored" |
1316 | 1317 | make -C "${PORTSDIR}/$origin_unflavored" -V FLAVORS 2> /dev/null | \ |
1317 | - tr '[:space:]' '\n' | grep -v '^$' > $tmp_flavors || : | |
1318 | + tr '[:space:]' '\n' | env LANG=C grep -v '^$' > $tmp_flavors || : | |
1318 | 1319 | if [ `wc -l < $tmp_flavors` -gt 0 ] |
1319 | 1320 | then |
1320 | 1321 | sed -E "s|^|$origin_unflavored_rpl@|" "$tmp_flavors" |
@@ -1327,7 +1328,7 @@ pkgsys_eval_ports_glob () | ||
1327 | 1328 | { |
1328 | 1329 | pkg_info_all_flavored_origins |
1329 | 1330 | cut -f 2 "${DBDIR}/installed_ports:pkg_vs_origin.tbl" 2> /dev/null |
1330 | - } | grep -E "$glob_regexp_allflavors" 2>&1 || : | |
1331 | + } | env LANG=C grep -E "$glob_regexp_allflavors" 2>&1 || : | |
1331 | 1332 | else |
1332 | 1333 | if expr "$glob" : '[a-z][a-zA-Z0-9_.+-]*[a-zA-Z0-9_.+]$' > /dev/null 2>&1 && \ |
1333 | 1334 | [ `expr "$glob" : '.*-[0-9]' 2>&1` -eq 0 ] |
@@ -1336,7 +1337,7 @@ pkgsys_eval_ports_glob () | ||
1336 | 1337 | else |
1337 | 1338 | glob_regexp2=$glob_regexp |
1338 | 1339 | fi |
1339 | - grep -n -E "$glob_regexp2" "$pkglist" 2>&1 | cut -d : -f 1 \ | |
1340 | + env LANG=C grep -n -E "$glob_regexp2" "$pkglist" 2>&1 | cut -d : -f 1 \ | |
1340 | 1341 | | while read index |
1341 | 1342 | do |
1342 | 1343 | sed -n ${index}p "$unflavored_origlist" |
@@ -1345,7 +1346,7 @@ pkgsys_eval_ports_glob () | ||
1345 | 1346 | origin_unflavored_rpl=`str_escape_replaceval "$origin_unflavored"` |
1346 | 1347 | fs_fix_unionfs_image_if_hidden "${PORTSDIR}/$origin_unflavored" |
1347 | 1348 | make -C "${PORTSDIR}/$origin_unflavored" -V FLAVORS 2> /dev/null | \ |
1348 | - tr '[:space:]' '\n' | grep -v '^$' > $tmp_flavors || : | |
1349 | + tr '[:space:]' '\n' | env LANG=C grep -v '^$' > $tmp_flavors || : | |
1349 | 1350 | [ `wc -l < $tmp_flavors` -gt 0 ] || echo > $tmp_flavors |
1350 | 1351 | sed -E "s/^/$origin_unflavored_rpl /" "$tmp_flavors" |
1351 | 1352 | done | while read origin_unflavored flavor |
@@ -1353,20 +1354,20 @@ pkgsys_eval_ports_glob () | ||
1353 | 1354 | if [ -n "$flavor" ] |
1354 | 1355 | then |
1355 | 1356 | if make -C "${PORTSDIR}/$origin_unflavored" package-name FLAVOR=$flavor 2> /dev/null | \ |
1356 | - grep -qE "$glob_regexp2" | |
1357 | + env LANG=C grep -qE "$glob_regexp2" | |
1357 | 1358 | then |
1358 | 1359 | echo "$origin_unflavored@$flavor" |
1359 | 1360 | fi |
1360 | 1361 | else |
1361 | 1362 | if make -C "${PORTSDIR}/$origin_unflavored" package-name 2> /dev/null | \ |
1362 | - grep -qE "$glob_regexp2" | |
1363 | + env LANG=C grep -qE "$glob_regexp2" | |
1363 | 1364 | then |
1364 | 1365 | echo "$origin_unflavored" |
1365 | 1366 | fi |
1366 | 1367 | fi |
1367 | 1368 | done || : |
1368 | 1369 | glob_regexp2=`echo "$glob_regexp" | sed -E 's/\$*$//' 2>&1 || :`'[[:space:]]' |
1369 | - grep -E "$glob_regexp2" "${DBDIR}/installed_ports:pkg_vs_origin.tbl" 2> /dev/null \ | |
1370 | + env LANG=C grep -E "$glob_regexp2" "${DBDIR}/installed_ports:pkg_vs_origin.tbl" 2> /dev/null \ | |
1370 | 1371 | | cut -f 2 || : |
1371 | 1372 | pkg_info_Ex "$glob_regexp" | while read pkgname |
1372 | 1373 | do |
@@ -1396,7 +1397,7 @@ pkgsys_create_backup_pkg () | ||
1396 | 1397 | then |
1397 | 1398 | pkgname_ptn=`str_escape_regexp "$pkgname"` |
1398 | 1399 | backup_pkg=`ls "${TMPDIR}"/package.tmp | \ |
1399 | - grep -m 1 -E "^${pkgname_ptn}\.(txz|tbz|tgz|tar|pkg)$"` || : | |
1400 | + env LANG=C grep -m 1 -E "^${pkgname_ptn}\.(txz|tbz|tgz|tar|pkg)$"` || : | |
1400 | 1401 | fi |
1401 | 1402 | if [ -z "$backup_pkg" ] |
1402 | 1403 | then |
@@ -1431,12 +1432,12 @@ pkgsys_delete_backup_pkg () | ||
1431 | 1432 | local origin origin_regexp |
1432 | 1433 | origin=$1 |
1433 | 1434 | origin_regexp=`str_escape_regexp "$origin"` |
1434 | - grep -E "^${origin_regexp}[[:space:]]" "${DBDIR}/backup_pkgarcs.lst" 2> /dev/null \ | |
1435 | + env LANG=C grep -E "^${origin_regexp}[[:space:]]" "${DBDIR}/backup_pkgarcs.lst" 2> /dev/null \ | |
1435 | 1436 | | cut -f 2 | while read pkgpath_cur |
1436 | 1437 | do |
1437 | 1438 | rm -f "$pkgpath_cur" |
1438 | 1439 | done |
1439 | - grep -v -E "^${origin_regexp}[[:space:]]" "${DBDIR}/backup_pkgarcs.lst" \ | |
1440 | + env LANG=C grep -v -E "^${origin_regexp}[[:space:]]" "${DBDIR}/backup_pkgarcs.lst" \ | |
1440 | 1441 | 2> /dev/null > ${DBDIR}/backup_pkgarcs.lst.tmp || : |
1441 | 1442 | mv "${DBDIR}/backup_pkgarcs.lst.tmp" "${DBDIR}/backup_pkgarcs.lst" |
1442 | 1443 | } |
@@ -1449,7 +1450,7 @@ pkgsys_get_backup_pkg () | ||
1449 | 1450 | tmpnewest=${TMPDIR}/pkgsys_get_backup_pkg::newest |
1450 | 1451 | origin_regexp=`str_escape_regexp "$origin"` |
1451 | 1452 | rm -f "$tmpnewest" |
1452 | - grep -E "^${origin_regexp}[[:space:]]" "${DBDIR}/backup_pkgarcs.lst" 2> /dev/null \ | |
1453 | + env LANG=C grep -E "^${origin_regexp}[[:space:]]" "${DBDIR}/backup_pkgarcs.lst" 2> /dev/null \ | |
1453 | 1454 | | cut -f 2 | while read pkgpath |
1454 | 1455 | do |
1455 | 1456 | pkgpath_newest=`cat "$tmpnewest" 2> /dev/null` || : |
@@ -1475,7 +1476,7 @@ pkgsys_chk_match_to_restored_files_by_backup_pkg () | ||
1475 | 1476 | origin=$1 |
1476 | 1477 | filelist=$2 |
1477 | 1478 | dbfile=${DBDIR}/backup/$origin/previously_installed_files |
1478 | - grep -qFx -f "$filelist" "$dbfile" 2> /dev/null | |
1479 | + env LANG=C grep -qFx -f "$filelist" "$dbfile" 2> /dev/null | |
1479 | 1480 | } |
1480 | 1481 | |
1481 | 1482 | # ============= Get a package name from a package archive file name ============= |
@@ -1497,7 +1498,7 @@ pkgsys_pkgname_to_pkgarc () | ||
1497 | 1498 | if [ "x$PKGSYS_USE_PKGNG" = xyes ] |
1498 | 1499 | then |
1499 | 1500 | pkgname_ptn=`str_escape_regexp "$pkgname"` |
1500 | - pkgnode=`ls "$pkgdir" 2> /dev/null | grep -m 1 -E "^${pkgname_ptn}\.(txz|tbz|tgz|tar|pkg)$"` || : | |
1501 | + pkgnode=`ls "$pkgdir" 2> /dev/null | env LANG=C grep -m 1 -E "^${pkgname_ptn}\.(txz|tbz|tgz|tar|pkg)$"` || : | |
1501 | 1502 | elif [ -e "$pkgdir/$pkgname.tbz" ] |
1502 | 1503 | then |
1503 | 1504 | pkgnode=$pkgname.tbz |
@@ -1513,8 +1514,8 @@ pkgsys_eval_ports_glob_even_if_nonexistent () | ||
1513 | 1514 | glob_pattern=$1 |
1514 | 1515 | { |
1515 | 1516 | pkgsys_eval_ports_glob "$glob_pattern" 2> /dev/null || : |
1516 | - echo "$glob_pattern" | grep -E '^[a-z]+/[a-zA-Z0-9_.+-]+(|@[a-zA-Z0-9_.+-]+)$' || : | |
1517 | - } | grep -v -e '^$' | sort -u | |
1517 | + echo "$glob_pattern" | env LANG=C grep -E '^[a-z]+/[a-zA-Z0-9_.+-]+(|@[a-zA-Z0-9_.+-]+)$' || : | |
1518 | + } | env LANG=C grep -v -e '^$' | sort -u | |
1518 | 1519 | } |
1519 | 1520 | |
1520 | 1521 | # ============= Evaluate glob patterns and add/remove non-existing/existing ones of them to/from a file ============= |
@@ -1527,7 +1528,7 @@ pkgsys_register_evaluated_globs () | ||
1527 | 1528 | dirpath=`dirname "$listpath"` |
1528 | 1529 | tmp_evaluated=${TMPDIR}/pkgsys_register_evaluated_globs:pkgsys_eval_ports_glob |
1529 | 1530 | echo "$@" | sed -E 's/[ :]+/\ |
1530 | -/g' | grep -v '^$' | sort -u | while read -r glob | |
1531 | +/g' | env LANG=C grep -v '^$' | sort -u | while read -r glob | |
1531 | 1532 | do |
1532 | 1533 | pkgsys_eval_ports_glob "$glob" > $tmp_evaluated |
1533 | 1534 | [ `wc -l < $tmp_evaluated` -ge 1 ] || \ |
@@ -1583,7 +1584,7 @@ pkgsys_get_conflicting_pkgs_patterns () | ||
1583 | 1584 | conflicts_config= |
1584 | 1585 | ;; |
1585 | 1586 | esac |
1586 | - echo "$conflicts $conflicts_makevar $conflicts_config" | tr ' ' '\n' | grep -v '^$' | sort -u | |
1587 | + echo "$conflicts $conflicts_makevar $conflicts_config" | tr ' ' '\n' | env LANG=C grep -v '^$' | sort -u | |
1587 | 1588 | } |
1588 | 1589 | |
1589 | 1590 | # ============= Get conflicting installed packages of a port ============= |
@@ -1611,7 +1612,7 @@ pkgsys_chk_conflict_by_a_pkg () | ||
1611 | 1612 | tmp_conflicts_ptn=${TMPDIR}/pkgsys_chk_conflict_by_a_pkg::conflicts_ptn |
1612 | 1613 | pkgsys_get_conflicting_pkgs_patterns "$mode" "$origin" \ |
1613 | 1614 | | str_convert_glob_to_regexp_pattern > $tmp_conflicts_ptn |
1614 | - echo "$pkg" | grep -q -E -f "$tmp_conflicts_ptn" | |
1615 | + echo "$pkg" | env LANG=C grep -q -E -f "$tmp_conflicts_ptn" | |
1615 | 1616 | } |
1616 | 1617 | |
1617 | 1618 | # ============= Check whether installed files are lost or broken for a package ============= |
@@ -1642,7 +1643,7 @@ pkgsys_sanitychk_pkgcontents () | ||
1642 | 1643 | break |
1643 | 1644 | fi |
1644 | 1645 | filename_esc=`str_escape_regexp "$filename"` |
1645 | - if file "$filename" | sed -E "s/^$filename_esc:[[:space:]]//" | grep -q '^ELF ' | |
1646 | + if file "$filename" | sed -E "s/^$filename_esc:[[:space:]]//" | env LANG=C grep -q '^ELF ' | |
1646 | 1647 | then |
1647 | 1648 | _is_reinstall_encouraged=yes |
1648 | 1649 | break |
@@ -1683,7 +1684,7 @@ pkgsys_get_current_port_oprions_timestamp () | ||
1683 | 1684 | { |
1684 | 1685 | ls -lD %Y%m%d:%H%M%S "${PORT_DBDIR}" | if [ -n "$portdb_needle_regexp" ] |
1685 | 1686 | then |
1686 | - grep -E "[[:space:]]$portdb_needle_regexp$" || : | |
1687 | + env LANG=C grep -E "[[:space:]]$portdb_needle_regexp$" || : | |
1687 | 1688 | else |
1688 | 1689 | cat |
1689 | 1690 | fi |
@@ -1743,12 +1744,12 @@ pkgsys_get_changed_port_oprions () | ||
1743 | 1744 | current_log=$2 |
1744 | 1745 | tmp_log=${TMPDIR}/pkgsys_get_changed_port_oprions.log |
1745 | 1746 | { |
1746 | - grep -vxF -f "$current_log" "$saved_log" || : | |
1747 | - grep -vxF -f "$saved_log" "$current_log" || : | |
1748 | - } | cut -w -f 1 | grep -v '^$' | sort -u > $tmp_log | |
1747 | + env LANG=C grep -vxF -f "$current_log" "$saved_log" || : | |
1748 | + env LANG=C grep -vxF -f "$saved_log" "$current_log" || : | |
1749 | + } | cut -w -f 1 | env LANG=C grep -v '^$' | sort -u > $tmp_log | |
1749 | 1750 | if pkgsys_is_dialog4ports_used |
1750 | 1751 | then |
1751 | - grep '_' "$tmp_log" || : | |
1752 | + env LANG=C grep '_' "$tmp_log" || : | |
1752 | 1753 | else |
1753 | 1754 | cat "$tmp_log" |
1754 | 1755 | fi |
@@ -174,7 +174,7 @@ program_exec_restartable_loop_operation () | ||
174 | 174 | iline=$(($iline+1)) |
175 | 175 | PROGRAM_STEP_PROGRESS=$(($PROGRAM_STEP_PROGRESS+1)) |
176 | 176 | PROGRAM_STEP_COUNTER="[$PROGRAM_STEP_PROGRESS/$PROGRAM_NUM_STEPS $(($PROGRAM_STEP_PROGRESS*100/$PROGRAM_NUM_STEPS))%]" |
177 | - if ! grep -q -Fx "$item" "$looplist.remain" 2> /dev/null | |
177 | + if ! env LANG=C grep -q -Fx "$item" "$looplist.remain" 2> /dev/null | |
178 | 178 | then |
179 | 179 | [ $iline -gt $nlines ] && PROGRAM_STEP_COUNTER_LAST_SKIPPED=yes |
180 | 180 | continue |
@@ -25,23 +25,23 @@ reinstall_skip () | ||
25 | 25 | message_target_relations "$REINSTALL_ORIGIN" |
26 | 26 | } |
27 | 27 | |
28 | -# ============= Check whether a package is forbidden due to conflict ============= | |
28 | +# ============= Check whether a package is forbidden due to conflict (only by referring to the record) ============= | |
29 | 29 | reinstall_quick_chk_forbidden_conflicts () |
30 | 30 | { |
31 | 31 | local pkg pkg_regexp_esc |
32 | 32 | pkg=$1 |
33 | 33 | pkg_regexp_esc=`str_escape_regexp "$pkg"` |
34 | - grep -qE "^$pkg_regexp_esc:" "${DBDIR}/forbidden_conflicts" 2> /dev/null | |
34 | + env LANG=C grep -qE "^$pkg_regexp_esc:" "${DBDIR}/forbidden_conflicts" 2> /dev/null | |
35 | 35 | } |
36 | 36 | |
37 | -# ============= Check whether a package is forbidden due to conflict ============= | |
37 | +# ============= Check whether a package is forbidden due to conflict (referring to both the record and the actual installation) ============= | |
38 | 38 | reinstall_chk_forbidden_conflicts () |
39 | 39 | { |
40 | 40 | local pkg tmp_forbidden pkg_regexp_esc |
41 | 41 | pkg=$1 |
42 | 42 | tmp_forbidden=${TMPDIR}/reinstall_chk_forbidden_conflicts:forbidden |
43 | 43 | pkg_regexp_esc=`str_escape_regexp "$pkg"` |
44 | - grep -E "^$pkg_regexp_esc:" "${DBDIR}/forbidden_conflicts" > $tmp_forbidden 2> /dev/null || return | |
44 | + env LANG=C grep -E "^$pkg_regexp_esc:" "${DBDIR}/forbidden_conflicts" > $tmp_forbidden 2> /dev/null || return | |
45 | 45 | pkg_info_e `cut -d : -f 3 "$tmp_forbidden"` |
46 | 46 | } |
47 | 47 |
@@ -97,7 +97,12 @@ reinstall_skip_if_in_a_list () | ||
97 | 97 | message=$1 |
98 | 98 | list=$2 |
99 | 99 | mode=$3 |
100 | - grep -q -Fx "$REINSTALL_ORIGIN" "${DBDIR}/$list" 2> /dev/null || return | |
100 | + env LANG=C grep -q -Fx "$REINSTALL_ORIGIN" "${DBDIR}/$list" 2> /dev/null || return | |
101 | + REINSTALL_ORIGIN_equiv=`database_query_get_equivalent_orgin "$REINSTALL_ORIGIN"` | |
102 | + if [ -n "$REINSTALL_ORIGIN_equiv" ] | |
103 | + then | |
104 | + env LANG=C grep -q -Fx "$REINSTALL_ORIGIN_equiv" "${DBDIR}/$list" 2> /dev/null || return | |
105 | + fi | |
101 | 106 | [ "x$mode" = xrestore ] && reinstall_restore_if_temporarily_deinstalled |
102 | 107 | reinstall_skip "$message" || : |
103 | 108 | } |
@@ -240,13 +245,15 @@ reinstall_deregister_stage_complete () | ||
240 | 245 | # Package names of conflict are given via stdin. |
241 | 246 | reinstall_backup_and_delete_conflicts () |
242 | 247 | { |
243 | - local pkg origin origin_regexp_esc backup_pkgdir backup_pkg | |
248 | + local pkg origin origin_equiv origin_regexp_esc origin_equiv_regexp_esc backup_pkgdir backup_pkg | |
244 | 249 | message_echo "INFO: Deinstalling conflicting packages for $REINSTALL_ORIGPKGTAG." |
245 | 250 | while read pkg |
246 | 251 | do |
247 | 252 | origin=`pkg_info_flavored_origin "$pkg"` |
253 | + origin_equiv=`database_query_get_equivalent_orgin "$origin"` | |
248 | 254 | message_echo "INFO: Backing up and deleting a conflict, $origin ($pkg)." |
249 | 255 | origin_regexp_esc=`str_escape_regexp "$origin"` |
256 | + origin_equiv_regexp_esc=`str_escape_regexp "$origin_equiv"` | |
250 | 257 | if [ -d "${DBDIR}/requires/$origin" ] |
251 | 258 | then |
252 | 259 | backup_pkgdir=${DBDIR}/backup_packages |
@@ -254,7 +261,7 @@ reinstall_backup_and_delete_conflicts () | ||
254 | 261 | backup_pkgdir=${PKGREPOSITORY} |
255 | 262 | fi |
256 | 263 | mkdir -p "$backup_pkgdir" |
257 | - if backup_pkg=`pkgsys_get_backup_pkg "$origin"` | |
264 | + if backup_pkg=`pkgsys_get_backup_pkg "$origin"` || backup_pkg=`pkgsys_get_backup_pkg "$origin_equiv"` | |
258 | 265 | then |
259 | 266 | message_echo "INFO: backup package already exists as $backup_pkg" |
260 | 267 | elif ! backup_pkg=`pkgsys_create_backup_pkg "$pkg" "$backup_pkgdir"` |
@@ -262,9 +269,16 @@ reinstall_backup_and_delete_conflicts () | ||
262 | 269 | message_echo "WARNING: Failed to create the backup package, the conflict is kept installed." >&2 |
263 | 270 | continue |
264 | 271 | fi |
265 | - grep -v -E "^${origin_regexp_esc}[[:space:]]" "${DBDIR}/deleted_conflicts" \ | |
272 | + env LANG=C grep -v -E "^${origin_regexp_esc}[[:space:]]" "${DBDIR}/deleted_conflicts" \ | |
266 | 273 | > ${DBDIR}/deleted_conflicts.tmp 2> /dev/null || : |
274 | + if [ -n "$origin_equiv_regexp_esc" ] | |
275 | + then | |
276 | + env LANG=C grep -v -E "^${origin_equiv_regexp_esc}[[:space:]]" "${DBDIR}/deleted_conflicts.tmp" \ | |
277 | + > ${DBDIR}/deleted_conflicts.tmp2 2> /dev/null || : | |
278 | + mv "${DBDIR}/deleted_conflicts.tmp2" "${DBDIR}/deleted_conflicts.tmp" | |
279 | + fi | |
267 | 280 | printf '%s\t%s\n' "$origin" "$pkg" >> ${DBDIR}/deleted_conflicts.tmp |
281 | + [ -n "$origin_equiv" ] && printf '%s\t%s\n' "$origin_equiv" "$pkg" >> ${DBDIR}/deleted_conflicts.tmp | |
268 | 282 | mv "${DBDIR}/deleted_conflicts.tmp" "${DBDIR}/deleted_conflicts" |
269 | 283 | pkg_delete_f "$pkg" || \ |
270 | 284 | { |
@@ -294,13 +308,14 @@ reinstall_backup_and_delete_remaining_install_conflicts__by_pkg () | ||
294 | 308 | # ============= Back up and delete remaining actual install conflict (for installation by port) ============= |
295 | 309 | reinstall_backup_and_delete_remaining_install_conflicts () |
296 | 310 | { |
297 | - local stagedir tmp_conflicts db_conflict | |
311 | + local stagedir tmp_conflicts db_conflict REINSTALL_ORIGIN_equiv | |
298 | 312 | tmp_conflicts=${TMPDIR}/reinstall_backup_and_delete_remaining_install_conflicts |
299 | 313 | db_conflict=$REINSTALL_DBNODE_DIR/possible_additional_conflict.csv |
300 | 314 | message_echo "(Checking installation conflict...)" |
301 | 315 | rm -rf "$db_conflict.tmp" "$tmp_conflicts".* |
302 | 316 | stagedir=`database_query_get_makevar_val "$REINSTALL_ORIGIN" STAGEDIR` |
303 | 317 | pkgsys_get_conflicting_installed_pkgs install "$REINSTALL_ORIGIN" > $tmp_conflicts.pkgs || : |
318 | + REINSTALL_ORIGIN_equiv=`database_query_get_equivalent_orgin "$REINSTALL_ORIGIN"` | |
304 | 319 | ( set -e |
305 | 320 | cd "$stagedir" |
306 | 321 | find . -not -type d |
@@ -309,9 +324,12 @@ reinstall_backup_and_delete_remaining_install_conflicts () | ||
309 | 324 | [ ! -e "$filepath" ] && continue |
310 | 325 | pkg=`pkg_which "$filepath" || :` |
311 | 326 | [ -z "$pkg" ] && continue |
312 | - grep -qFx "$pkg" "$tmp_conflicts.pkgs" && continue | |
327 | + env LANG=C grep -qFx "$pkg" "$tmp_conflicts.pkgs" && continue | |
313 | 328 | origin=`pkg_info_flavored_origin "$pkg"` |
314 | 329 | [ x"$origin" = x"$REINSTALL_ORIGIN" ] && continue |
330 | + [ x"$origin" = x"$REINSTALL_ORIGIN_equiv" ] && continue | |
331 | + origin_equiv=`database_query_get_equivalent_orgin "$origin"` | |
332 | + [ x"$origin_equiv" = x"$REINSTALL_ORIGIN" ] && continue | |
315 | 333 | printf '%s\t%s\n' "$pkg" "$filepath" >> $db_conflict.tmp |
316 | 334 | done |
317 | 335 | if [ -e "$db_conflict.tmp" ] |
@@ -363,9 +381,9 @@ reinstall_remove_needless_possible_conflict () | ||
363 | 381 | cut -f 1 "$db_conflict" | sort -u > $tmp_db.conflict_pkg.old |
364 | 382 | cut -f 1 "$db_conflict.tmp" | sort -u > $tmp_db.conflict_pkg.new |
365 | 383 | suffix=`echo ":$REINSTALL_ORIGIN:$REINSTALL_NEWPKGNAME" | str_escape_replaceval_filter` |
366 | - grep -vFx -f "$tmp_db.conflict_pkg.new" "$tmp_db.conflict_pkg.old" | \ | |
384 | + env LANG=C grep -vFx -f "$tmp_db.conflict_pkg.new" "$tmp_db.conflict_pkg.old" | \ | |
367 | 385 | sed -E "s/$/$suffix/" > $tmp_db.conflict_pkg.needless.filter |
368 | - grep -vFx -f "$tmp_db.conflict_pkg.needless.filter" "$db_forbidden" > $db_forbidden.tmp || : | |
386 | + env LANG=C grep -vFx -f "$tmp_db.conflict_pkg.needless.filter" "$db_forbidden" > $db_forbidden.tmp || : | |
369 | 387 | mv "$db_forbidden.tmp" "$db_forbidden" |
370 | 388 | mv "$db_conflict.tmp" "$db_conflict" |
371 | 389 | [ `wc -l < $db_conflict` -gt 0 ] || rm "$db_conflict" |
@@ -374,21 +392,24 @@ reinstall_remove_needless_possible_conflict () | ||
374 | 392 | # ============= Restoration of backed up conflict ============= |
375 | 393 | reinstall_restore_conflicts () |
376 | 394 | { |
377 | - local origin_current tmpsrc | |
395 | + local origin_current tmpsrc origin_current_equiv | |
378 | 396 | origin_current=$1 |
379 | 397 | [ $opt_fetch_only = no -a $opt_dry_run = no ] || return 0 |
380 | 398 | [ -e "${DBDIR}/deleted_conflicts" ] || return 0 |
381 | 399 | tmpsrc=${TMPDIR}/reinstall_restore_conflicts::deleted_conflicts |
382 | 400 | cp "${DBDIR}/deleted_conflicts" "$tmpsrc" |
401 | + origin_current_equiv=`database_query_get_equivalent_orgin "$origin_current"` | |
383 | 402 | while read origin pkg |
384 | 403 | do |
385 | 404 | pkg_regexp_esc=`str_escape_regexp "$pkg"` |
386 | - origins_init=`database_query_initial_orgins "$origin" | grep -vFx "$origin" || :` | |
405 | + origins_init=`database_query_initial_orgins "$origin" | env LANG=C grep -vFx "$origin" || :` | |
387 | 406 | origin_replace=`echo "$origin" \ |
388 | 407 | | sed -E -f "${DBDIR}/REPLACE.complete_sed_pattern"` |
389 | 408 | [ "x$origin_replace" = "x$origin" ] && origin_replace= |
390 | 409 | is_to_dereg_from_list=no |
391 | - if [ -n "$origin_current" -a "x$origin" = "x$origin_current" ] || \ | |
410 | + origin_equiv=`database_query_get_equivalent_orgin "$origin"` | |
411 | + if [ -n "$origin" -a \( "x$origin" = "x$origin_current" -o "x$origin" = "x$origin_current_equiv" \) ] || \ | |
412 | + [ -n "$origin_equiv" -a "x$origin_equiv" = "x$origin_current" ] || \ | |
392 | 413 | pkg_info_e "$pkg" || pkgsys_exists_from_orig "$origin" |
393 | 414 | then |
394 | 415 | is_to_dereg_from_list=yes |
@@ -420,7 +441,7 @@ reinstall_restore_conflicts () | ||
420 | 441 | then |
421 | 442 | pkg_current= |
422 | 443 | origin_current= |
423 | - for origin_trial in $origin $origins_init $origin_replace | |
444 | + for origin_trial in $origin $origin_equiv $origins_init $origin_replace | |
424 | 445 | do |
425 | 446 | pkg_trial=`pkgsys_get_installed_pkg_from_origin "$origin_trial" || :` |
426 | 447 | [ -z "$pkg_trial" ] && continue |
@@ -432,33 +453,33 @@ reinstall_restore_conflicts () | ||
432 | 453 | pkgname_msg=$pkg |
433 | 454 | origin_msg=$origin |
434 | 455 | [ "x$pkg_current" = "x$pkg" ] || pkgname_msg="$pkg => $pkg_current" |
435 | - [ "x$origin_current" = "x$origin" ] || origin_msg="$origin => $origin_current" | |
456 | + [ "x$origin_current" = "x$origin" -o "x$origin_current" = "x$origin_equiv" ] || origin_msg="$origin => $origin_current" | |
436 | 457 | if [ $is_skipped = yes ] |
437 | 458 | then |
438 | 459 | message_echo "WARNING: Conflicting package is installed: $origin_msg ($pkgname_msg)" |
439 | 460 | else |
440 | 461 | message_echo "INFO: $origin_msg ($pkgname_msg) is already restored." |
441 | - grep -v -E "[[:space:]]$pkg_regexp_esc$" "${DBDIR}/deleted_conflicts" \ | |
462 | + env LANG=C grep -v -E "[[:space:]]$pkg_regexp_esc$" "${DBDIR}/deleted_conflicts" \ | |
442 | 463 | > ${DBDIR}/deleted_conflicts.tmp || : |
443 | 464 | mv "${DBDIR}/deleted_conflicts.tmp" "${DBDIR}/deleted_conflicts" |
444 | 465 | fi |
445 | 466 | continue |
446 | 467 | fi |
447 | 468 | [ $is_skipped = yes ] && continue |
448 | - if grep -q -Fx -e "$origin" -e "$origin_replace" "${DBDIR}/taboo.all.list" 2> /dev/null | |
469 | + if env LANG=C grep -q -Fx -e "$origin" -e "$origin_equiv" -e "$origin_replace" "${DBDIR}/taboo.all.list" 2> /dev/null | |
449 | 470 | then |
450 | 471 | message_echo "INFO: Restoration of a conflict, $origin ($pkg), is avoided because it is taboo." |
451 | 472 | continue |
452 | 473 | fi |
453 | 474 | message_echo "INFO: Restoring a former conflict, $origin ($pkg)." |
454 | - if ! backup_pkg=`pkgsys_get_backup_pkg "$origin"` | |
475 | + if ! backup_pkg=`pkgsys_get_backup_pkg "$origin"` || ! backup_pkg=`pkgsys_get_backup_pkg "$origin_equiv"` | |
455 | 476 | then |
456 | 477 | message_echo "WARNING: No backup exists, gave up." >&2 |
457 | 478 | continue |
458 | 479 | fi |
459 | 480 | if pkg_add_fF "$backup_pkg" |
460 | 481 | then |
461 | - grep -v -E "[[:space:]]$pkg_regexp_esc$" "${DBDIR}/deleted_conflicts" \ | |
482 | + env LANG=C grep -v -E "[[:space:]]$pkg_regexp_esc$" "${DBDIR}/deleted_conflicts" \ | |
462 | 483 | > ${DBDIR}/deleted_conflicts.tmp || : |
463 | 484 | mv "${DBDIR}/deleted_conflicts.tmp" "${DBDIR}/deleted_conflicts" |
464 | 485 | else |
@@ -473,7 +494,14 @@ reinstall_are_requirements_ready () | ||
473 | 494 | [ -e "$REINSTALL_DBNODE_DIR/requirements.all.direct" ] || return 0 |
474 | 495 | while read origin |
475 | 496 | do |
476 | - pkgsys_exists_from_orig "$origin" || return 1 | |
497 | + if ! pkgsys_exists_from_orig "$origin" | |
498 | + then | |
499 | + origin_equiv=`database_query_get_equivalent_orgin "$origin"` | |
500 | + if [ -n "$origin_equiv" ] && ! pkgsys_exists_from_orig "$origin_equiv" | |
501 | + then | |
502 | + return 1 | |
503 | + fi | |
504 | + fi | |
477 | 505 | done < $REINSTALL_DBNODE_DIR/requirements.all.direct |
478 | 506 | } |
479 | 507 |
@@ -489,18 +517,30 @@ reinstall_chk_and_restore_requirements () | ||
489 | 517 | | while read origin |
490 | 518 | do |
491 | 519 | pkgsys_exists_from_orig "$origin" && continue |
492 | - if grep -q -Fx "$origin" "${DBDIR}/taboo.all.list" 2> /dev/null | |
520 | + origin_equiv=`database_query_get_equivalent_orgin "$origin"` | |
521 | + pkgsys_exists_from_orig "$origin_equiv" && continue | |
522 | + if env LANG=C grep -q -Fx "$origin" "${DBDIR}/taboo.all.list" 2> /dev/null \ | |
523 | + || { [ -n "$origin_equiv" ] && env LANG=C grep -q -Fx "$origin_equiv" "${DBDIR}/taboo.all.list" 2> /dev/null; } | |
493 | 524 | then |
494 | 525 | message_echo "INFO: Restoration of a requirement [$origin] is avoided because it is set taboo." |
495 | 526 | touch "$tmp_isfailed" |
496 | 527 | break |
497 | 528 | fi |
498 | - origins_init=`database_query_initial_orgins "$origin" | grep -vFx "$origin" || :` | |
529 | + if [ -n "$origin_equiv" ] | |
530 | + then | |
531 | + origins_init=`{ database_query_initial_orgins "$origin"; database_query_initial_orgins "$origin_equiv"; } | env LANG=C grep -vFx -e "$origin" -e "$origin_equiv" || :` | |
532 | + else | |
533 | + origins_init=`{ database_query_initial_orgins "$origin"; } | env LANG=C grep -vFx "$origin" || :` | |
534 | + fi | |
499 | 535 | origin_replace=`echo "$origin" \ |
500 | 536 | | sed -E -f "${DBDIR}/REPLACE.complete_sed_pattern"` |
537 | + origin_equiv_replace=`echo "$origin_equiv" \ | |
538 | + | sed -E -f "${DBDIR}/REPLACE.complete_sed_pattern"` | |
501 | 539 | [ "x$origin_replace" = "x$origin" ] && origin_replace= |
540 | + [ "x$origin_equiv_replace" = "x$origin_equiv" ] && origin_equiv_replace= | |
541 | + [ -n "$origin_replace" ] || origin_replace=$origin_equiv_replace | |
502 | 542 | is_installed=no |
503 | - for origin_orig in $origins_init $origin_replace | |
543 | + for origin_orig in $origins_init $origin_replace $origin_equiv_replace | |
504 | 544 | do |
505 | 545 | [ "x$origin_orig" = "x$origin" ] && continue |
506 | 546 | if pkgsys_exists_from_orig "$origin_orig" |
@@ -508,7 +548,7 @@ reinstall_chk_and_restore_requirements () | ||
508 | 548 | is_installed=yes |
509 | 549 | break |
510 | 550 | fi |
511 | - if grep -q -Fx "$origin_orig" "${DBDIR}/taboo.all.list" 2> /dev/null | |
551 | + if env LANG=C grep -q -Fx "$origin_orig" "${DBDIR}/taboo.all.list" 2> /dev/null | |
512 | 552 | then |
513 | 553 | message_echo "INFO: Restoration of a requirement [$origin_orig] is avoided because it is set taboo." |
514 | 554 | touch "$tmp_isfailed" |
@@ -518,13 +558,14 @@ reinstall_chk_and_restore_requirements () | ||
518 | 558 | done |
519 | 559 | [ $is_installed = yes ] && continue |
520 | 560 | [ $is_installed = taboo ] && break |
521 | - for origin_orig in $origin $origins_init $origin_replace | |
561 | + for origin_orig in $origin $origin_equiv $origins_init $origin_replace $origin_equiv_replace | |
522 | 562 | do |
523 | 563 | pkgarc=`pkgsys_get_backup_pkg "$origin_orig"` && break |
524 | 564 | done |
525 | 565 | if [ -z "$pkgarc" ] |
526 | 566 | then |
527 | - if grep -q -Fx "$origin" "${DBDIR}/failed.list" 2> /dev/null | |
567 | + if env LANG=C grep -q -Fx "$origin" "${DBDIR}/failed.list" 2> /dev/null || \ | |
568 | + { [ -n "$origin_equiv" ] && env LANG=C grep -q -Fx "$origin_equiv" "${DBDIR}/failed.list" 2> /dev/null; } | |
528 | 569 | then |
529 | 570 | touch "$tmp_isfailed" |
530 | 571 | break |
@@ -546,7 +587,7 @@ reinstall_chk_and_restore_requirements () | ||
546 | 587 | message_echo "INFO: Restoring a backed-up requirement [$origin ($pkg)]." |
547 | 588 | if pkg_add_fF "$pkgarc" |
548 | 589 | then |
549 | - grep -v -E "[[:space:]]$pkg_regexp_esc$" "${DBDIR}/deleted_conflicts" \ | |
590 | + env LANG=C grep -v -E "[[:space:]]$pkg_regexp_esc$" "${DBDIR}/deleted_conflicts" \ | |
550 | 591 | > ${DBDIR}/deleted_conflicts.tmp 2> /dev/null || : |
551 | 592 | mv "${DBDIR}/deleted_conflicts.tmp" "${DBDIR}/deleted_conflicts" |
552 | 593 | else |
@@ -562,7 +603,7 @@ reinstall_pkg_backup () | ||
562 | 603 | { |
563 | 604 | local backup_pkg pkg |
564 | 605 | reinstall_chk_stage_complete PKG_BACKUP && return |
565 | - pkg=`echo "$REINSTALL_CURRENTPKG" | tr ' ' '\n' | grep -v '^$' | tail -n 1` | |
606 | + pkg=`echo "$REINSTALL_CURRENTPKG" | tr ' ' '\n' | env LANG=C grep -v '^$' | tail -n 1` | |
566 | 607 | if [ -n "$pkg" ] |
567 | 608 | then |
568 | 609 | message_echo "-- (Creating temporary backup package for $REINSTALL_ORIGPKGTAG)" |
@@ -581,7 +622,7 @@ reinstall_pkg_backup () | ||
581 | 622 | # ============= Deinstallation of the currently installed package ============= |
582 | 623 | reinstall_deinstall () |
583 | 624 | { |
584 | - local tmp_installedpkg installed_pkgs dev_out dev_err | |
625 | + local tmp_installedpkg REINSTALL_ORIGIN_equiv installed_pkgs dev_out dev_err | |
585 | 626 | dev_out=/dev/stdout |
586 | 627 | dev_err=/dev/stderr |
587 | 628 | if [ $opt_batch_mode = yes ] |
@@ -593,7 +634,8 @@ reinstall_deinstall () | ||
593 | 634 | pkgsys_get_installed_pkg_from_origin "$REINSTALL_ORIGIN" > $tmp_installedpkg |
594 | 635 | [ `wc -l < $tmp_installedpkg` -gt 0 ] || return 0 |
595 | 636 | installed_pkgs=`tr '\n' ' ' < $tmp_installedpkg | sed 's/ *$//'` |
596 | - if pkgsys_is_necessary_pkgtool "$REINSTALL_ORIGIN" | |
637 | + REINSTALL_ORIGIN_equiv=`database_query_get_equivalent_orgin "$REINSTALL_ORIGIN"` | |
638 | + if pkgsys_is_necessary_pkgtool "$REINSTALL_ORIGIN" || pkgsys_is_necessary_pkgtool "$REINSTALL_ORIGIN_equiv" | |
597 | 639 | then |
598 | 640 | message_echo "INFO: Deinstalling $installed_pkgs by $PKGSYS_CMD_PKG_DELETE." |
599 | 641 | pkg_delete_f $installed_pkgs || \ |
@@ -624,13 +666,15 @@ reinstall_deinstall_old_ports () | ||
624 | 666 | while read origin_old |
625 | 667 | do |
626 | 668 | pkgsys_get_installed_pkg_from_origin "$origin_old" |
669 | + origin_old_equiv=`database_query_get_equivalent_orgin "$origin_old"` | |
670 | + pkgsys_get_installed_pkg_from_origin "$origin_old_equiv" | |
627 | 671 | done < $REINSTALL_FROMNODE_DIR/old_origs | reinstall_backup_and_delete_conflicts |
628 | 672 | } |
629 | 673 | |
630 | 674 | # ============= Recovery after failure of installation of the new package ============= |
631 | 675 | reinstall_failed_install_recover () |
632 | 676 | { |
633 | - local backedup_version backup_pkg dev_out dev_err | |
677 | + local backedup_version backup_pkg dev_out dev_err REINSTALL_ORIGIN_equiv | |
634 | 678 | dev_out=/dev/stdout |
635 | 679 | dev_err=/dev/stderr |
636 | 680 | if [ $opt_batch_mode = yes ] |
@@ -647,7 +691,9 @@ reinstall_failed_install_recover () | ||
647 | 691 | message_echo "INFO: Trying to deinstall by ports to make sure (This may cause negligible warnings)." |
648 | 692 | reinstall_make deinstall > $dev_out 2> $dev_err|| : |
649 | 693 | backedup_version=`cat "$REINSTALL_FROMNODE_DIR/backedup_version" 2> /dev/null || :` |
650 | - if grep -q -Fx "$REINSTALL_ORIGIN" "${DBDIR}/taboo.all.list" 2> /dev/null | |
694 | + REINSTALL_ORIGIN_equiv=`database_query_get_equivalent_orgin "$REINSTALL_ORIGIN"` | |
695 | + if env LANG=C grep -q -Fx "$REINSTALL_ORIGIN" "${DBDIR}/taboo.all.list" 2> /dev/null || \ | |
696 | + { [ -n "$REINSTALL_ORIGIN_equiv" ] && env LANG=C grep -q -Fx "$REINSTALL_ORIGIN_equiv" "${DBDIR}/taboo.all.list" 2> /dev/null; } | |
651 | 697 | then |
652 | 698 | message_echo "INFO: Restoration of the backup of $backedup_version is avoided because it is taboo." |
653 | 699 | elif [ -n "$backedup_version" ] |
@@ -680,8 +726,10 @@ reinstall_failed_install_recover () | ||
680 | 726 | # ============= Report an installation success to the all dependents ============= |
681 | 727 | reinstall_tell_update_to_depandents () |
682 | 728 | { |
683 | - local tag level dbsuffix | |
729 | + local REINSTALL_ORIGIN_equiv tag level dbsuffix | |
684 | 730 | pkgsys_is_pkgtool "$REINSTALL_ORIGIN" && return |
731 | + REINSTALL_ORIGIN_equiv=`database_query_get_equivalent_orgin "$REINSTALL_ORIGIN"` | |
732 | + pkgsys_is_pkgtool "$REINSTALL_ORIGIN_equiv" && return | |
685 | 733 | reinstall_chk_stage_complete TELL_UPDATE_TO_DEPANDENTSL && return |
686 | 734 | for tag in all run build none |
687 | 735 | do |
@@ -695,6 +743,11 @@ reinstall_tell_update_to_depandents () | ||
695 | 743 | | sort -u \ |
696 | 744 | | while read origin_dependent |
697 | 745 | do |
746 | + echo "$origin_dependent" | |
747 | + origin_dependent_equiv=`database_query_get_equivalent_orgin "$origin_dependent"` | |
748 | + [ -z "$origin_dependent_equiv" ] || echo "$origin_dependent_equiv" | |
749 | + done | while read origin_dependent | |
750 | + do | |
698 | 751 | [ -d "${DBDIR}/requires/$origin_dependent" ] || continue |
699 | 752 | touch "${DBDIR}/requires/$origin_dependent/need_reinstall_due_to_upgraded_requirements.$dbsuffix" |
700 | 753 | fileedit_rm_a_line "$origin_dependent" \ |
@@ -707,7 +760,7 @@ reinstall_tell_update_to_depandents () | ||
707 | 760 | reinstall_register_stage_complete TELL_UPDATE_TO_DEPANDENTS |
708 | 761 | } |
709 | 762 | |
710 | -# ============= Closing operations after an installation success ============= | |
763 | +# ============= Closing operations after a successful installation ============= | |
711 | 764 | reinstall_closing_operations_after_successful_install () |
712 | 765 | { |
713 | 766 | local tag level |
@@ -730,15 +783,17 @@ reinstall_closing_operations_after_successful_install () | ||
730 | 783 | } | sort -u | while read initial_orig |
731 | 784 | do |
732 | 785 | initial_orig_regexp=`str_escape_regexp "$initial_orig"` |
733 | - grep -E "^${initial_orig_regexp}[[:space:]]" "${DBDIR}/deleted_conflicts" 2> /dev/null \ | |
786 | + initial_orig_equiv=`database_query_get_equivalent_orgin "$initial_orig"` | |
787 | + initial_orig_equiv_regexp=`str_escape_regexp "$initial_orig_equiv"` | |
788 | + env LANG=C grep -E "^${initial_orig_regexp}[[:space:]]" "${DBDIR}/deleted_conflicts" 2> /dev/null \ | |
734 | 789 | | cut -f 2 | while read initial_pkg |
735 | 790 | do |
736 | 791 | pkg_regexp=`str_escape_regexp "$initial_pkg"` |
737 | - grep -v -E "^${pkg_regexp}:" "${DBDIR}/forbidden_conflicts" \ | |
792 | + env LANG=C grep -v -E "^${pkg_regexp}:" "${DBDIR}/forbidden_conflicts" \ | |
738 | 793 | > ${DBDIR}/forbidden_conflicts.tmp 2> /dev/null || : |
739 | 794 | mv "${DBDIR}/forbidden_conflicts.tmp" "${DBDIR}/forbidden_conflicts" |
740 | 795 | done |
741 | - grep -v -E "^${initial_orig_regexp}[[:space:]]" "${DBDIR}/deleted_conflicts" \ | |
796 | + env LANG=C grep -v -E "^${initial_orig_regexp}[[:space:]]" "${DBDIR}/deleted_conflicts" \ | |
742 | 797 | > ${DBDIR}/deleted_conflicts.tmp 2> /dev/null || : |
743 | 798 | mv "${DBDIR}/deleted_conflicts.tmp" "${DBDIR}/deleted_conflicts" |
744 | 799 | pkgsys_delete_backup_pkg "$initial_orig" |
@@ -758,21 +813,21 @@ reinstall_fetch_missing_distfiles () | ||
758 | 813 | tmp_missing_fetch=${TMPDIR}/reinstall_fetch_missing_distfiles:missing_fetch.sh |
759 | 814 | rm -rf "$tmp_fetch.pre" |
760 | 815 | reinstall_make_anymode fetch-list 2> /dev/null > $tmp_fetch.src || return |
761 | - grep '^SHA256[[:space:]]' "$port_path/distinfo" | \ | |
816 | + env LANG=C grep '^SHA256[[:space:]]' "$port_path/distinfo" | \ | |
762 | 817 | sed -E 's/^SHA256[[:space:]]+\(([^)]*)\).*/\1/' | \ |
763 | 818 | while read relative_distfile_path |
764 | 819 | do |
765 | 820 | if ! { testhash=`( cd "${DISTDIR}" && sha256 "$relative_distfile_path" ) 2> /dev/null` && \ |
766 | - grep -qxF "$testhash" "$port_path/distinfo"; } | |
821 | + env LANG=C grep -qxF "$testhash" "$port_path/distinfo"; } | |
767 | 822 | then |
768 | 823 | relative_distfile_path_ptn=`str_escape_regexp "|| echo \"$relative_distfile_path\" not fetched; }"` |
769 | - if grep -E "$relative_distfile_path_ptn$" "$tmp_fetch.src" | |
824 | + if env LANG=C grep -E "$relative_distfile_path_ptn$" "$tmp_fetch.src" | |
770 | 825 | then |
771 | 826 | subdir_distfile=`dirname "$relative_distfile_path"` |
772 | 827 | [ "x$subdir_distfile" = x. ] || echo "mkdir -p \"${DISTDIR}/$subdir_distfile\"" >> $tmp_fetch.pre |
773 | 828 | fi |
774 | 829 | fi |
775 | - done | grep -v '^[[:space:]]*$' > $tmp_fetch.main || : | |
830 | + done | env LANG=C grep -v '^[[:space:]]*$' > $tmp_fetch.main || : | |
776 | 831 | [ -e "$tmp_fetch.pre" ] && sort -u "$tmp_fetch.pre" |
777 | 832 | cat "$tmp_fetch.main" |
778 | 833 | } |
@@ -817,18 +872,23 @@ reinstall_execcmd_getstdout_errlog () | ||
817 | 872 | # Return status 0 for no problem about missing ports |
818 | 873 | reinstall_chk_missing_requirement () |
819 | 874 | { |
820 | - local tmp_filter tmp_miising | |
875 | + local tmp_filter tmp_missing | |
821 | 876 | tmp_filter=${TMPDIR}/reinstall_chk_missing_requirement::requirements.all_but_test.unflavored |
822 | - tmp_miising=${TMPDIR}/reinstall_chk_missing_requirement::missing_requirements | |
877 | + tmp_missing=${TMPDIR}/reinstall_chk_missing_requirement::missing_requirements | |
823 | 878 | message_echo "Checking whether any required package is missing or too old..." |
824 | 879 | sed 's/@.*//' "$REINSTALL_DBNODE_DIR/requirements.all.full" > $tmp_filter || : |
825 | - if reinstall_make missing 2> /dev/null | grep -Fx -f "$tmp_filter" > $tmp_miising | |
880 | + reinstall_make missing 2> /dev/null | env LANG=C grep -Fx -f "$tmp_filter" | while read missing_orig | |
881 | + do | |
882 | + missing_equiv=`database_query_get_equivalent_orgin "$missing_orig"` | |
883 | + [ -n "$missing_equiv" ] && ! pkg_info_eO "$missing_equiv" && echo "$missing_orig" | |
884 | + done > $tmp_missing | |
885 | + if [ `wc -l < $tmp_missing` -gt 0 ] | |
826 | 886 | then |
827 | 887 | message_echo "Found missing/too old requirements:" |
828 | - message_cat < $tmp_miising | |
888 | + message_cat < $tmp_missing | |
829 | 889 | { |
830 | 890 | echo "Found missing/too old requirements:" |
831 | - cat "$tmp_miising" | |
891 | + cat "$tmp_missing" | |
832 | 892 | } > "$REINSTALL_DBNODE_DIR/error.log" |
833 | 893 | reinstall_restore_conflicts "$REINSTALL_ORIGIN" |
834 | 894 | reinstall_restore_if_temporarily_deinstalled |
@@ -867,7 +927,7 @@ reinstall_exec_chk_skip () | ||
867 | 927 | if expr "$REINSTALL_CURRENTPKG" : '.* .*' > /dev/null |
868 | 928 | then |
869 | 929 | message_echo "WARNING: Multiple packages are registered for this port. Reinstallation is needed to fix it." >&2 |
870 | - elif grep -q -Fx "$REINSTALL_ORIGIN" "${DBDIR}/damaged_package" 2> /dev/null | |
930 | + elif env LANG=C grep -q -Fx "$REINSTALL_ORIGIN" "${DBDIR}/damaged_package" 2> /dev/null | |
871 | 931 | then |
872 | 932 | message_echo "WARNING: Installed files have invalid checksums for this port. Reinstallation is needed to fix it." >&2 |
873 | 933 | else |
@@ -1201,7 +1261,7 @@ reinstall_exec_reinstall_freeze_if_necessary () | ||
1201 | 1261 | # Return status 0 for no concern about freezing requirements |
1202 | 1262 | reinstall_exec_reinstall_avoid_if_any_unfrozen_requirements_exists () |
1203 | 1263 | { |
1204 | - if grep -qFx "$REINSTALL_DBNODE_DIR/requirements.all.full" "${DBDIR}/freeze.all.list" 2> /dev/null | |
1264 | + if env LANG=C grep -qFx "$REINSTALL_DBNODE_DIR/requirements.all.full" "${DBDIR}/freeze.all.list" 2> /dev/null | |
1205 | 1265 | then |
1206 | 1266 | reinstall_restore_conflicts |
1207 | 1267 | { |
@@ -1354,9 +1414,10 @@ reinstall_exec_reinstall_chk_interactive_mode () | ||
1354 | 1414 | # Return status 1 for error end |
1355 | 1415 | reinstall_exec_reinstall_build () |
1356 | 1416 | { |
1357 | - local flag_restarted_build build_args is_build_env_modified conflicts_install dev_out dev_err | |
1417 | + local flag_restarted_build build_args is_build_env_modified conflicts_install dev_out dev_err REINSTALL_ORIGIN_equiv | |
1358 | 1418 | dev_out=/dev/stdout |
1359 | 1419 | dev_err=/dev/stderr |
1420 | + REINSTALL_ORIGIN_equiv=`database_query_get_equivalent_orgin "$REINSTALL_ORIGIN"` | |
1360 | 1421 | if [ $opt_batch_mode = yes ] |
1361 | 1422 | then |
1362 | 1423 | dev_out=/dev/null |
@@ -1393,7 +1454,7 @@ reinstall_exec_reinstall_build () | ||
1393 | 1454 | echo "$conflicts_install" | reinstall_backup_and_delete_conflicts |
1394 | 1455 | is_build_env_modified=yes |
1395 | 1456 | fi |
1396 | - if pkgsys_exists_from_orig "$REINSTALL_ORIGIN" | |
1457 | + if pkgsys_exists_from_orig "$REINSTALL_ORIGIN" "$REINSTALL_ORIGIN_equiv" | |
1397 | 1458 | then |
1398 | 1459 | message_echo "INFO: The currently installed package for this port is deinstalled for retrial because it may have effects on build." |
1399 | 1460 | reinstall_pkg_backup || : |
@@ -1472,13 +1533,14 @@ reinstall_exec_reinstall_stage () | ||
1472 | 1533 | reinstall_deregister_stage in_stage |
1473 | 1534 | } |
1474 | 1535 | |
1475 | -# ============= Reinstallation of the current origin: Install process============= | |
1536 | +# ============= Reinstallation of the current origin: Install process ============= | |
1476 | 1537 | # Return status 1 for error end |
1477 | 1538 | reinstall_exec_reinstall_install () |
1478 | 1539 | { |
1479 | - local insttarget dev_out dev_err | |
1540 | + local insttarget dev_out dev_err REINSTALL_ORIGIN_equiv | |
1480 | 1541 | dev_out=/dev/stdout |
1481 | 1542 | dev_err=/dev/stderr |
1543 | + REINSTALL_ORIGIN_equiv=`database_query_get_equivalent_orgin "$REINSTALL_ORIGIN"` | |
1482 | 1544 | if [ $opt_batch_mode = yes ] |
1483 | 1545 | then |
1484 | 1546 | dev_out=/dev/null |
@@ -1579,9 +1641,10 @@ reinstall_exec_reinstall_install () | ||
1579 | 1641 | | while read origin_bak pkgpath_bak |
1580 | 1642 | do |
1581 | 1643 | pkg_bak=`pkgsys_pkgarc_to_pkgname "$pkgpath_bak"` |
1582 | - if [ "$origin_bak" = "$REINSTALL_ORIGIN" ] | |
1644 | + origin_bak_equiv=`database_query_get_equivalent_orgin "$origin_bak"` | |
1645 | + if [ "x$origin_bak" = "x$REINSTALL_ORIGIN" -o "x$origin_bak_equiv" = "x$REINSTALL_ORIGIN" -o "x$origin_bak" = "x$REINSTALL_ORIGIN_equiv" ] | |
1583 | 1646 | then |
1584 | - [ "$pkg_bak" = "$REINSTALL_NEWPKGNAME" ] && continue | |
1647 | + [ "x$pkg_bak" = "x$REINSTALL_NEWPKGNAME" ] && continue | |
1585 | 1648 | elif reinstall_quick_chk_forbidden_conflicts "$pkg_bak" |
1586 | 1649 | then |
1587 | 1650 | continue |
@@ -1703,7 +1766,7 @@ reinstall_exec () | ||
1703 | 1766 | REINSTALL_DBSUFFIX=`options_get_dependency_type`.`options_get_dependency_level` |
1704 | 1767 | REINSTALL_NEWPKGNAME=`database_build_get_new_pkgname "$REINSTALL_ORIGIN"` |
1705 | 1768 | REINSTALL_IS_FROZEN=no |
1706 | - grep -qFx "$REINSTALL_ORIGIN" "${DBDIR}/freeze.all.list" 2> /dev/null && REINSTALL_IS_FROZEN=yes | |
1769 | + env LANG=C grep -qFx "$REINSTALL_ORIGIN" "${DBDIR}/freeze.all.list" 2> /dev/null && REINSTALL_IS_FROZEN=yes | |
1707 | 1770 | message_stage_title "$PROGRAM_STEP_COUNTER $REINSTALL_ORIGPKGTAG" |
1708 | 1771 | reinstall_exec_chk_skip && reinstall_exec_reinstall || : |
1709 | 1772 | message_echo |
@@ -9,7 +9,7 @@ | ||
9 | 9 | |
10 | 10 | # ============= Database of options which are given at each run and not saved ============= |
11 | 11 | # [Syntax of option databases] |
12 | -# short_name, long_name, variable, defult_vaule, set_value | |
12 | +# short_name, long_name, variable, default_value, set_value | |
13 | 13 | # Columns are delimited by tab characters. |
14 | 14 | options_db_onetime () |
15 | 15 | { |
@@ -71,8 +71,8 @@ command_do_reinst_ports () | ||
71 | 71 | if [ -n "$target_pkg" ] |
72 | 72 | then |
73 | 73 | target_regexp=`str_escape_regexp "$target_pkg"` |
74 | - timestamp_init=`grep -E "^${target_regexp}[[:space:]]" "${DBDIR}/initial_pkgs_snapshot.csv" | cut -f 2` | |
75 | - timestamp_fin=`grep -E "^${target_regexp}[[:space:]]" "${ETCDIR}/final_pkgs_snapshot.csv" | cut -f 2` | |
74 | + timestamp_init=`env LANG=C grep -E "^${target_regexp}[[:space:]]" "${DBDIR}/initial_pkgs_snapshot.csv" | cut -f 2` | |
75 | + timestamp_fin=`env LANG=C grep -E "^${target_regexp}[[:space:]]" "${ETCDIR}/final_pkgs_snapshot.csv" | cut -f 2` | |
76 | 76 | if [ -n "$timestamp_init" -a -n "$timestamp_fin" ] |
77 | 77 | then |
78 | 78 | pkgtype_init=`expr "$timestamp_init" : '\([^:]*\):' || :` |
@@ -182,8 +182,8 @@ command_do_deinst_remining_olg_pkgs () | ||
182 | 182 | { |
183 | 183 | message_section_title "Deinstalling remaining old packages if any..." |
184 | 184 | pkg_get_pkgs_timestamps | \ |
185 | - grep -vE "`pkgsys_pkgtools_pkgs_filter_regexp`"> ${TMPDIR}/current_pkgs_snapshot.csv | |
186 | - grep -Fxv -f "${ETCDIR}/final_pkgs_snapshot.csv" "${TMPDIR}/current_pkgs_snapshot.csv" | \ | |
185 | + env LANG=C grep -vE "`pkgsys_pkgtools_pkgs_filter_regexp`"> ${TMPDIR}/current_pkgs_snapshot.csv | |
186 | + env LANG=C grep -Fxv -f "${ETCDIR}/final_pkgs_snapshot.csv" "${TMPDIR}/current_pkgs_snapshot.csv" | \ | |
187 | 187 | cut -f 1 | while read pkg_old |
188 | 188 | do |
189 | 189 | pkg_delete_f "$pkg_old" |
@@ -9,7 +9,7 @@ | ||
9 | 9 | |
10 | 10 | # ============= Database of options which are given at each run and not saved ============= |
11 | 11 | # [Syntax of option databases] |
12 | -# short_name, long_name, variable, defult_vaule, set_value | |
12 | +# short_name, long_name, variable, default_value, set_value | |
13 | 13 | # Columns are delimited by tab characters. |
14 | 14 | options_db_onetime () |
15 | 15 | { |
@@ -195,7 +195,7 @@ The delimiter is comma (",") by default and changeable by \fB\-E\fR option. | ||
195 | 195 | .PD 0 |
196 | 196 | .TP |
197 | 197 | \fB\-\-fullcourse\fR |
198 | -Carry out the \fBdo\fR process as the "full course" automatic mode where update of the ports tree and package repository are done first at the target host environment and thhen operation in the builder \fBchroot\fR(8) environment is started by cleaning of the temporary database and execution of \fBportsreinstall\fR(8) initiated with option \fB\-CGSjqx\fR (\fB\-CGSYajqx\fR if \fB\-a\fR option is set). | |
198 | +Carry out the \fBdo\fR process as the "full course" automatic mode where update of the ports tree and package repository are done first at the target host environment and then operation in the builder \fBchroot\fR(8) environment is started by cleaning of the temporary database and execution of \fBportsreinstall\fR(8) initiated with option \fB\-CGSjqx\fR (\fB\-CGSYajqx\fR if \fB\-a\fR option is set). | |
199 | 199 | Resuming \fBdo\fR command automatically executes \fBportsreinstall\fR(8) in the builder \fBchroot\fR(8) environment. |
200 | 200 | With \fB\-a\fR option, the all detected leaf and obsolete packages will be deleted. |
201 | 201 | .PD |
@@ -337,6 +337,9 @@ See also the corresponding section of \fBportsreinstall\fR(8). | ||
337 | 337 | The variables are conveyed to the forked environment from the target host. |
338 | 338 | .SH HISTORY |
339 | 339 | This utility first appeared as a part of \fBportsreinstall\fR(8) version 4.0.0 released on June 29, 2018. |
340 | +.SH BUGS | |
341 | +This tool is still experimental and may not work in typical environments. | |
342 | +It has been observed that \fBpkg\-add\fR(8) command froze at the preparation stage in a ZFS-mounted environment with 12.2-RELEASE. | |
340 | 343 | .SH "SEE ALSO" |
341 | 344 | \fBchroot\fR(8) |
342 | 345 | \fBportsreinstall\fR(8), |