Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- data/miniconda3/bin/activateAdded+6
- data/miniconda3/bin/acyclicAdded
- data/miniconda3/bin/adigAdded
- data/miniconda3/bin/ahostAdded
- data/miniconda3/bin/bdftogdAdded+204
- data/miniconda3/bin/bzcmpAdded+76
- data/miniconda3/bin/bzdiffAdded+76
- data/miniconda3/bin/cairo-traceAdded+136
- data/miniconda3/bin/ccompsAdded
- data/miniconda3/bin/circoAdded
- data/miniconda3/bin/convertAdded
- data/miniconda3/bin/cphAdded+11
- data/miniconda3/bin/dbus-cleanup-socketsAdded
- data/miniconda3/bin/dot2gxlAdded
- data/miniconda3/bin/f2pyAdded+7
- data/miniconda3/bin/fc-cacheAdded
- data/miniconda3/bin/fc-listAdded
- data/miniconda3/bin/fc-scanAdded
- data/miniconda3/bin/fonttoolsAdded+7
- data/miniconda3/bin/fribidiAdded
- data/miniconda3/bin/gd2togifAdded
- data/miniconda3/bin/gdtopngAdded
- data/miniconda3/bin/gettext.shAdded+135
- data/miniconda3/bin/gif2webpAdded
- data/miniconda3/bin/gifclrmpAdded
- data/miniconda3/bin/gtscheckAdded
- data/miniconda3/bin/gvpackAdded
- data/miniconda3/bin/gvprAdded
- data/miniconda3/bin/hb-subsetAdded
- data/miniconda3/bin/icu-configAdded+771
- data/miniconda3/bin/icuinfoAdded
- data/miniconda3/bin/idn2Added
- data/miniconda3/bin/jpegtranAdded
- data/miniconda3/bin/json_ppAdded+240
- data/miniconda3/bin/libdeflate-gunzipAdded
- data/miniconda3/bin/lzcmpAdded+220
- data/miniconda3/bin/lzgrepAdded+300
- data/miniconda3/bin/lzmoreAdded+80
- data/miniconda3/bin/magickAdded
- data/miniconda3/bin/msgcommAdded
- data/miniconda3/bin/msgconvAdded
- data/miniconda3/bin/msginitAdded
- data/miniconda3/bin/msgunfmtAdded
- data/miniconda3/bin/msguniqAdded
- data/miniconda3/bin/ngettextAdded
- data/miniconda3/bin/nviselAdded+7
- data/miniconda3/bin/perlAdded
- data/miniconda3/bin/perlbugAdded+1518
- data/miniconda3/bin/perlthanksAdded+1518
- data/miniconda3/bin/pngfixAdded
123456#!/bin/sh_CONDA_ROOT="/home/zangyihe/miniconda3"# Copyright (C) 2012 Anaconda, Inc# SPDX-License-Identifier: BSD-3-Clause\. "$_CONDA_ROOT/etc/profile.d/conda.sh" || return $?conda activate "$@"123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204#!/usr/bin/perl -w
## Simple convertor from bdf to gd font format.## Author: Jan Pazdziora, adelton@fi.muni.cz, http://www.fi.muni.cz/~adelton/# at Faculty of Informatics, Masaryk University in Brno, Czech Republic.## Example of use:# fstobdf -s fontserverhost:7100 -fn 8x16 | ./bdftogd FontLarge gdfontl#
use strict;
my $VERSION = '0.60';my $now = localtime;
if (@ARGV != 2) { die "usage: bdftogd fontname filename, eg. bdftogd FontLarge gdfontl\n"; }
my $gdname = shift;$gdname = 'gd' . $gdname unless $gdname =~ /^gd/i;
my $filename = shift;$filename = 'gd' . $filename unless $filename =~ /^gd/i;
if (-f "$filename.c") { die "File $filename.c already exists, won't overwrite\n"; }if (-f "$filename.h") { die "File $filename.h already exists, won't overwrite\n"; }
my ($width, $height);my (@data, @left, @bottom);my ($globalleft, $globaltop);
my ($minchar, $maxchar);
my ($copyright, $fontdef);
my $currentchar;my $gobitmap = 0;
while (<>) { chomp; s/\r$//; my ($tag, $value) = split / /, $_, 2; die "Font is not fixed width\n" if $tag eq 'SPACING' and not $value =~ /[CM]/i;
$currentchar = $value if $tag eq 'ENCODING'; $minchar = $currentchar if not defined $minchar or $currentchar < $minchar; $maxchar = $currentchar if not defined $maxchar or $currentchar > $maxchar;
if ($tag eq 'ENDCHAR') { $gobitmap = 0; my $bottom = $globaltop - $bottom[$currentchar];
if ($bottom > 0) { $data[$currentchar] = substr $data[$currentchar], 0, length($data[$currentchar]) - $bottom * $width; } else { $data[$currentchar] .= '0' x (-$bottom * $width); } }
if ($tag eq 'FONTBOUNDINGBOX') { my ($tag, $wid, $hei, $left, $top) = split / /; if (defined $top) { $globalleft = $left; $globaltop = $top; $height = $hei; $width = $wid; } } if ($tag eq 'FONT' and not defined $fontdef) { $fontdef = $value; } if ($tag eq 'COPYRIGHT' and not defined $copyright) { $copyright = $value; }
if ($tag eq 'BBX') { my ($tag, $wid, $hei, $left, $bottom) = split / /; if (defined $bottom) { $left[$currentchar] = $left; $bottom[$currentchar] = $bottom; } }
if ($gobitmap) { my $value = pack 'H*', $_; my $bits = unpack 'B*', $value; $bits = ('0' x $left[$currentchar]) . $bits; $bits .= '0' x ($width - length $bits); $bits = substr $bits, 0, $width; $data[$currentchar] .= $bits; }
if ($tag eq 'BITMAP') { $gobitmap = 1; $data[$currentchar] = ''; } }
my $info = <<"EOF";/* This is a header file for gd font, generated using bdftogd version $VERSION by Jan Pazdziora, adelton\@fi.muni.cz from bdf font $fontdef at $now.EOF
if (defined $copyright) { $info .= <<"EOF"; The original bdf was holding following copyright: $copyright */EOF }else { $info .= <<"EOF"; No copyright info was found in the original bdf. */EOF }
open FILEC, "> $filename.c" or die "Error writing $filename.c: $!\n";open FILEH, "> $filename.h" or die "Error writing $filename.h: $!\n";print FILEC <<"EOF";
$info
#include "$filename.h"
char ${gdname}Data[] = {EOF
$minchar = 0 unless defined $minchar;$maxchar = 255 unless defined $maxchar;for (my $i = $minchar; $i <= $maxchar; $i++) { $data[$i] = '' unless defined $data[$i]; $data[$i] = '0' x ($width * $height - length $data[$i]) . $data[$i];
print FILEC "/* Char $i */\n"; for my $line (0 .. $height - 1) { print FILEC join ',', split(//, substr($data[$i], $line * $width, $width)), "\n"; }
print FILEC "\n";
next;
for my $line (0 .. $height - 1) { print substr($data[$i], $line * $width, $width), "\n"; } }
my $capdef = "\U_${filename}_H_";
print FILEC <<"EOF";
};
gdFont ${gdname}Rep = { @{[ $maxchar - $minchar + 1]}, $minchar, $width, $height, ${gdname}Data};
gdFontPtr ${gdname} = &${gdname}Rep;
/* This file has not been truncated. */
EOF
close FILEC;
print FILEH <<"EOF";
#ifndef $capdef#define $capdef 1
$info
#include "gd.h"
extern gdFontPtr $gdname;
#endif
EOF
1;12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576#!/bin/sh# sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh
# Bzcmp/diff wrapped for bzip2, # adapted from zdiff by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
# Bzcmp and bzdiff are used to invoke the cmp or the diff pro-# gram on compressed files. All options specified are passed# directly to cmp or diff. If only 1 file is specified, then# the files compared are file1 and an uncompressed file1.gz.# If two files are specified, then they are uncompressed (if# necessary) and fed to cmp or diff. The exit status from cmp# or diff is preserved.
PATH="/usr/bin:/bin:$PATH"; export PATHprog=`echo $0 | sed 's|.*/||'`case "$prog" in *cmp) comp=${CMP-cmp} ;; *) comp=${DIFF-diff} ;;esac
OPTIONS=FILES=for ARGdo case "$ARG" in -*) OPTIONS="$OPTIONS $ARG";; *) if test -f "$ARG"; then FILES="$FILES $ARG" else echo "${prog}: $ARG not found or not a regular file" exit 1 fi ;; esacdoneif test -z "$FILES"; then echo "Usage: $prog [${comp}_options] file [file]" exit 1fiset $FILESif test $# -eq 1; then FILE=`echo "$1" | sed 's/.bz2$//'` bzip2 -cd "$FILE.bz2" | $comp $OPTIONS - "$FILE" STAT="$?"
elif test $# -eq 2; then case "$1" in *.bz2) case "$2" in *.bz2) F=`echo "$2" | sed 's|.*/||;s|.bz2$||'` tmp=`mktemp "${TMPDIR:-/tmp}"/bzdiff.XXXXXXXXXX` || { echo 'cannot create a temporary file' >&2 exit 1 } bzip2 -cdfq "$2" > "$tmp" bzip2 -cdfq "$1" | $comp $OPTIONS - "$tmp" STAT="$?" /bin/rm -f "$tmp";;
*) bzip2 -cdfq "$1" | $comp $OPTIONS - "$2" STAT="$?";; esac;; *) case "$2" in *.bz2) bzip2 -cdfq "$2" | $comp $OPTIONS "$1" - STAT="$?";; *) $comp $OPTIONS "$1" "$2" STAT="$?";; esac;; esacelse echo "Usage: $prog [${comp}_options] file [file]" exit 1fiexit "$STAT"12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576#!/bin/sh# sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh
# Bzcmp/diff wrapped for bzip2, # adapted from zdiff by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
# Bzcmp and bzdiff are used to invoke the cmp or the diff pro-# gram on compressed files. All options specified are passed# directly to cmp or diff. If only 1 file is specified, then# the files compared are file1 and an uncompressed file1.gz.# If two files are specified, then they are uncompressed (if# necessary) and fed to cmp or diff. The exit status from cmp# or diff is preserved.
PATH="/usr/bin:/bin:$PATH"; export PATHprog=`echo $0 | sed 's|.*/||'`case "$prog" in *cmp) comp=${CMP-cmp} ;; *) comp=${DIFF-diff} ;;esac
OPTIONS=FILES=for ARGdo case "$ARG" in -*) OPTIONS="$OPTIONS $ARG";; *) if test -f "$ARG"; then FILES="$FILES $ARG" else echo "${prog}: $ARG not found or not a regular file" exit 1 fi ;; esacdoneif test -z "$FILES"; then echo "Usage: $prog [${comp}_options] file [file]" exit 1fiset $FILESif test $# -eq 1; then FILE=`echo "$1" | sed 's/.bz2$//'` bzip2 -cd "$FILE.bz2" | $comp $OPTIONS - "$FILE" STAT="$?"
elif test $# -eq 2; then case "$1" in *.bz2) case "$2" in *.bz2) F=`echo "$2" | sed 's|.*/||;s|.bz2$||'` tmp=`mktemp "${TMPDIR:-/tmp}"/bzdiff.XXXXXXXXXX` || { echo 'cannot create a temporary file' >&2 exit 1 } bzip2 -cdfq "$2" > "$tmp" bzip2 -cdfq "$1" | $comp $OPTIONS - "$tmp" STAT="$?" /bin/rm -f "$tmp";;
*) bzip2 -cdfq "$1" | $comp $OPTIONS - "$2" STAT="$?";; esac;; *) case "$2" in *.bz2) bzip2 -cdfq "$2" | $comp $OPTIONS "$1" - STAT="$?";; *) $comp $OPTIONS "$1" "$2" STAT="$?";; esac;; esacelse echo "Usage: $prog [${comp}_options] file [file]" exit 1fiexit "$STAT"123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136#!/bin/sh
prefix=/home/zangyihe/miniconda3exec_prefix=/home/zangyihe/miniconda3
nofile=flush=nocallers=nomarkdirty=compress=
usage() {cat << EOFusage: cairo-trace [--no-file] commandcairo-trace will generate a log of all calls made by command tocairo. This log will be stored in a file in the local directorycalled command.pid.trace.Whatever else happens is driven by its argument: --flush - Flush the output trace after every call. --no-file - Disable the creation of an output file. Outputs to the terminal instead. --no-callers - Do not lookup the caller address/symbol/line whilst tracing. --mark-dirty - Record image data for cairo_mark_dirty() [default] --no-mark-dirty - Do not record image data for cairo_mark_dirty() --compress - Compress the output with LZMA --profile - Combine --no-callers and --no-mark-dirty and --compress
Environment variables understood by cairo-trace: CAIRO_TRACE_FLUSH - flush the output after every function call. CAIRO_TRACE_LINE_INFO - emit line information for most function calls.EOFexit}
skip=1while test $skip -eq 1; do skip=0 case $1 in --flush) skip=1 flush=1 ;; --no-file) skip=1 nofile=1 ;; --no-callers) skip=1 nocallers=1 ;; --mark-dirty) skip=1 nomarkdirty= ;; --no-mark-dirty) skip=1 nomarkdirty=1 ;; --compress) skip=1 compress=1 nofile=1 ;; --profile) skip=1 compress=1 nomarkdirty=1 nocallers=1 nofile=1 ;; --version) echo "cairo-trace, version 1.18.4." exit ;; --help) usage ;; esac if test $skip -eq 1; then shift fidone
if test $# -eq 0; then usagefi
CAIRO_TRACE_PROG_NAME="$1"export CAIRO_TRACE_PROG_NAME
if test "x$CAIRO_TRACE_SO" = "x"; then CAIRO_TRACE_SO="" for lib in /home/zangyihe/miniconda3/lib/cairo/libcairo-trace.4 /home/zangyihe/miniconda3/lib/cairo/libcairo-trace.4* /home/zangyihe/miniconda3/lib/cairo/libcairo-trace.*.4 ; do if test -h "$lib" -o -f "$lib"; then CAIRO_TRACE_SO="$lib" break fi donefiif test "x$CAIRO_TRACE_SO" = "x"; then echo "Could not find the cairo-trace shared library in /home/zangyihe/miniconda3/lib/cairo/." >&2 echo "Set the CAIRO_TRACE_SO environment variable to the full path of the library." >&2 exit 15fi
LD_PRELOAD="$CAIRO_TRACE_SO"DYLD_INSERT_LIBRARIES="$CAIRO_TRACE_SO"DYLD_FORCE_FLAT_NAMESPACE=1export LD_PRELOADexport DYLD_INSERT_LIBRARIESexport DYLD_FORCE_FLAT_NAMESPACE
if test -n "$nocallers"; then CAIRO_TRACE_LINE_INFO=0 export CAIRO_TRACE_LINE_INFOfi
if test -n "$nomarkdirty"; then CAIRO_TRACE_MARK_DIRTY=0 export CAIRO_TRACE_MARK_DIRTYfi
if test -n "$flush"; then CAIRO_TRACE_FLUSH=1 export CAIRO_TRACE_FLUSHfi
if test -z "$nofile"; then CAIRO_TRACE_OUTDIR=`pwd` "$@"elif test -n "$compress"; then name=`basename $1` echo Generating compressed trace file $name.$$.lzma CAIRO_TRACE_FD=3 "$@" 3>&1 >/dev/null | lzma -cz9 > $name.$$.lzmaelse CAIRO_TRACE_FD=3 "$@" 3>&1 >/dev/nullfi1234567891011#!/home/zangyihe/miniconda3/bin/python
# -*- coding: utf-8 -*-import reimport sys
from conda_package_handling.cli import main
if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit(main())1234567#!/home/zangyihe/miniconda3/bin/python3.13import sysfrom numpy.f2py.f2py2e import mainif __name__ == '__main__': if sys.argv[0].endswith('.exe'): sys.argv[0] = sys.argv[0][:-4] sys.exit(main())1234567#!/home/zangyihe/miniconda3/bin/python3.13import sysfrom fontTools.__main__ import mainif __name__ == '__main__': if sys.argv[0].endswith('.exe'): sys.argv[0] = sys.argv[0][:-4] sys.exit(main())123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135#! /bin/sh## Copyright (C) 2003, 2005-2007, 2011, 2018-2020 Free Software Foundation, Inc.## This program is free software: you can redistribute it and/or modify# it under the terms of the GNU Lesser General Public License as published by# the Free Software Foundation; either version 2.1 of the License, or# (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU Lesser General Public License for more details.## You should have received a copy of the GNU Lesser General Public License# along with this program. If not, see <https://www.gnu.org/licenses/>.#
# Find a way to echo strings without interpreting backslash.if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then echo='echo'else if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then echo='printf %s\n' else echo_func () { cat <<EOT$*EOT } echo='echo_func' fifi
# This script is primarily a shell function library. In order for# ". gettext.sh" to find it, we install it in $PREFIX/bin (that is usually# contained in $PATH), rather than in some other location such as# $PREFIX/share/sh-scripts or $PREFIX/share/gettext. In order to not violate# the Filesystem Hierarchy Standard when doing so, this script is executable.# Therefore it needs to support the standard --help and --version.if test -z "${ZSH_VERSION+set}"; then # zsh is not POSIX compliant: By default, while ". gettext.sh" is executed, # it sets $0 to "gettext.sh", defeating the purpose of this test. But # fortunately we know that when running under zsh, this script is always # being sourced, not executed, because hardly anyone is crazy enough to # install zsh as /bin/sh. case "$0" in gettext.sh | */gettext.sh | *\\gettext.sh) progname=$0 package=gettext-runtime version=0.21 # func_usage # outputs to stdout the --help usage message. func_usage () { echo "GNU gettext shell script function library version $version" echo "Usage: . gettext.sh" } # func_version # outputs to stdout the --version message. func_version () { echo "$progname (GNU $package) $version" echo "Copyright (C) 2003-2020 Free Software Foundation, Inc.License GPLv2+: GNU GPL version 2 or later <https://gnu.org/licenses/gpl.html>This is free software: you are free to change and redistribute it.There is NO WARRANTY, to the extent permitted by law." echo "Written by" "Bruno Haible" } if test $# = 1; then case "$1" in --help | --hel | --he | --h ) func_usage; exit 0 ;; --version | --versio | --versi | --vers | --ver | --ve | --v ) func_version; exit 0 ;; esac fi func_usage 1>&2 exit 1 ;; esacfi
# eval_gettext MSGID# looks up the translation of MSGID and substitutes shell variables in the# result.eval_gettext () { gettext "$1" | (export PATH `envsubst --variables "$1"`; envsubst "$1")}
# eval_ngettext MSGID MSGID-PLURAL COUNT# looks up the translation of MSGID / MSGID-PLURAL for COUNT and substitutes# shell variables in the result.eval_ngettext () { ngettext "$1" "$2" "$3" | (export PATH `envsubst --variables "$1 $2"`; envsubst "$1 $2")}
# eval_pgettext MSGCTXT MSGID# looks up the translation of MSGID in the context MSGCTXT and substitutes# shell variables in the result.eval_pgettext () { gettext --context="$1" "$2" | (export PATH `envsubst --variables "$2"`; envsubst "$2")}
# eval_npgettext MSGCTXT MSGID MSGID-PLURAL COUNT# looks up the translation of MSGID / MSGID-PLURAL for COUNT in the context# MSGCTXT and substitutes shell variables in the result.eval_npgettext () { ngettext --context="$1" "$2" "$3" "$4" | (export PATH `envsubst --variables "$2 $3"`; envsubst "$2 $3")}
# Note: This use of envsubst is much safer than using the shell built-in 'eval'# would be.# 1) The security problem with Chinese translations that happen to use a# character such as \xe0\x60 is avoided.# 2) The security problem with malevolent translators who put in command lists# like "$(...)" or "`...`" is avoided.# 3) The translations can only refer to shell variables that are already# mentioned in MSGID or MSGID-PLURAL.## Note: "export PATH" above is a dummy; this is for the case when# `envsubst --variables ...` returns nothing.## Note: In eval_ngettext above, "$1 $2" means a string whose variables set is# the union of the variables set of "$1" and "$2".## Note: The minimal use of backquote above ensures that trailing newlines are# not dropped, not from the gettext invocation and not from the value of any# shell variable.## Note: Field splitting on the `envsubst --variables ...` result is desired,# since envsubst outputs the variables, separated by newlines. Pathname# wildcard expansion or tilde expansion has no effect here, since the words# output by "envsubst --variables ..." consist solely of alphanumeric# characters and underscore.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771#!/bin/sh## -*-sh-*-#set -x# BEGIN of icu-config-top# Copyright (C) 2016 and later: Unicode, Inc. and others.# License & terms of use: http://www.unicode.org/copyright.html#******************************************************************************# Copyright (C) 1999-2013, International Business Machines# Corporation and others. All Rights Reserved.#******************************************************************************# This script is designed to aid configuration of ICU.# rpath links a library search path right into the binaries.## Note: it's preferred to use the .pc files rather than icu-config.#
### END of icu-config-top
## Zero out prefix.execprefix=prefix=
loaddefs(){
# Following from icu/icu4c/source/config/Makefile.inc# Copyright (C) 2016 and later: Unicode, Inc. and others.# License & terms of use: http://www.unicode.org/copyright.html## -*-makefile-*-#******************************************************************************# Copyright (C) 1999-2014, International Business Machines# Corporation and others. All Rights Reserved.#******************************************************************************# This Makefile.inc is designed to be included into projects which make use# of the ICU.
# CONTENTS OF THIS FILE# 1). Base configuration information and linkage# 2). Variables giving access to ICU tools# 3). Host information# 4). Compiler flags and settings # 5). Data Packaging directives# 6). Include of platform make fragment (mh-* file)
#################################################################### *1* base configuration information and linkage#################################################################### The PREFIX is the base of where ICU is installed.# Inside this directory you should find bin, lib, include/unicode, # etc. If ICU is not installed in this directory, you must change the# following line. There should exist ${prefix}/include/unicode/utypes.h# for example.default_prefix="/home/zangyihe/miniconda3"if [ "x${prefix}" = "x" ]; then prefix="$default_prefix"; fiexec_prefix="${prefix}"libdir="${exec_prefix}/lib"libexecdir="${exec_prefix}/libexec"bindir="${exec_prefix}/bin"datarootdir="${prefix}/share"datadir="${datarootdir}"sbindir="${exec_prefix}/sbin"
# about the ICU versionVERSION="73.1"UNICODE_VERSION="15.0"
# The prefix for ICU libraries, normally 'icu'ICUPREFIX="icu"PACKAGE="icu"LIBICU="lib${ICUPREFIX}"
# Static library prefix and file extensionSTATIC_PREFIX="s"LIBSICU="lib${STATIC_PREFIX}${ICUPREFIX}"A="a"
# Suffix at the end of libraries. Usually empty.ICULIBSUFFIX=""# ICULIBSUFFIX_VERSION is non-empty if it is to contain a library# version. For example, if it is 21, it means libraries are named# libicuuc21.so for example.
# rpath links a library search path right into the binaries.## mh-files MUST NOT override RPATHLDFLAGS unless they provide## equivalent '#SH#' lines for icu-config fixupdefault_ENABLE_RPATH="NO"if [ "x${ENABLE_RPATH}" = "x" ]; then ENABLE_RPATH="$default_ENABLE_RPATH"; fiRPATHLDFLAGS="${LD_RPATH}${LD_RPATH_PRE}${libdir}"
# icu-config version of above 'if':case "x$ENABLE_RPATH" in x[yY]*) ENABLE_RPATH=YES RPATHLDFLAGS="${LD_RPATH}${LD_RPATH_PRE}${libdir}" ;;
x[nN]*) ENABLE_RPATH=NO RPATHLDFLAGS="" ;;
x) ENABLE_RPATH=NO RPATHLDFLAGS="" ;;
*) echo $0: Unknown --enable-rpath value ${ENABLE_RPATH} 1>&2 exit 3 ;;esac
# Name flexibility for the library naming scheme. Any modifications should# be made in the mh- file for the specific platform.DATA_STUBNAME="data"COMMON_STUBNAME="uc"I18N_STUBNAME="i18n"LAYOUTEX_STUBNAME="lx"IO_STUBNAME="io"TOOLUTIL_STUBNAME="tu"CTESTFW_STUBNAME="test"
### To link your application with ICU:# 1. use LDFLAGS, CFLAGS, etc from above# 2. link with ${ICULIBS}# 3. optionally, add one or more of:# - ${ICULIBS_I18N} - i18n library, formatting, etc.# - ${ICULIBS_ICUIO} - ICU stdio equivalent library
ICULIBS_COMMON="-l${ICUPREFIX}uc${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}"ICULIBS_DATA="-l${ICUPREFIX}${DATA_STUBNAME}${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}"ICULIBS_I18N="-l${ICUPREFIX}${I18N_STUBNAME}${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}"ICULIBS_TOOLUTIL="-l${ICUPREFIX}tu${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}"ICULIBS_CTESTFW="-l${ICUPREFIX}ctestfw${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}"ICULIBS_ICUIO="-l${ICUPREFIX}io${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}"ICULIBS_OBSOLETE="-l${ICUPREFIX}obsolete${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}"ICULIBS_LAYOUTEX="-l${ICUPREFIX}lx${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}"ICULIBS_BASE="-L${libdir}"
# for icu-config to test withICULIBS_COMMON_LIB_NAME="${LIBICU}${COMMON_STUBNAME}${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}.${SO}"ICULIBS_COMMON_LIB_NAME_A="${LIBICU}${COMMON_STUBNAME}${ICULIBSUFFIX}.${A}"
# ICULIBS is the set of libraries your application should link# with usually. Many applications will want to add ${ICULIBS_I18N} as well. ICULIBS="${ICULIBS_BASE} ${ICULIBS_I18N} ${ICULIBS_COMMON} ${ICULIBS_DATA} "
# Proper echo newline handling is needed in icu-configECHO_N="-n"ECHO_C=""# Not currently being used but good to have for proper tab handlingECHO_T=""
#################################################################### *2* access to ICU tools#################################################################### Environment variable to set a runtime search path# (Overridden when necessary in -mh files)LDLIBRARYPATH_ENVVAR="LD_LIBRARY_PATH"
# Versioned target for a shared library## FINAL_SO_TARGET = ${SO_TARGET}.${SO_TARGET_VERSION}## MIDDLE_SO_TARGET = ${SO_TARGET}.${SO_TARGET_VERSION_MAJOR}
# Access to important ICU tools.# Use as follows: ${INVOKE} ${GENRB} arguments .. INVOKE="${LDLIBRARYPATH_ENVVAR}=${libdir}:$$${LDLIBRARYPATH_ENVVAR} ${LEAK_CHECKER}"GENCCODE="${sbindir}/genccode"ICUPKG="${sbindir}/icupkg"GENCMN="${sbindir}/gencmn"GENRB="${bindir}/genrb"PKGDATA="${bindir}/pkgdata"
# moved here because of dependenciespkgdatadir="${datadir}/${PACKAGE}${ICULIBSUFFIX}/${VERSION}"pkglibdir="${libdir}/${PACKAGE}${ICULIBSUFFIX}/${VERSION}"
#################################################################### *3* Information about the host###################################################################
# Information about the host that 'configure' was run on.host="x86_64-conda-linux-gnu"host_alias="x86_64-conda-linux-gnu"host_cpu="x86_64"host_vendor="conda"host_os="linux-gnu"# Our platform canonical name (as determined by configure)# this is a #define value (i.e. U_XXXX or XXXX)platform="U_LINUX"
#################################################################### *4* compiler flags and misc. options###################################################################AR="/croot/icu_1692293016303/_build_env/bin/x86_64-conda-linux-gnu-ar"# initial tab keeps it out of the shell version.ARFLAGS=" ${ARFLAGS}"CC="/croot/icu_1692293016303/_build_env/bin/x86_64-conda-linux-gnu-cc"CPP="/croot/icu_1692293016303/_build_env/bin/x86_64-conda-linux-gnu-cpp"CFLAGS=""CPPFLAGS="-I${prefix}/include"CXXFLAGS=""CXX="/croot/icu_1692293016303/_build_env/bin/x86_64-conda-linux-gnu-c++"DEFAULT_MODE="dll"DEFS="-DPACKAGE_NAME=\"ICU\" -DPACKAGE_TARNAME=\"International\ Components\ for\ Unicode\" -DPACKAGE_VERSION=\"73.1\" -DPACKAGE_STRING=\"ICU\ 73.1\" -DPACKAGE_BUGREPORT=\"http://icu-project.org/bugs\" -DPACKAGE_URL=\"http://icu-project.org\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSIZEOF_VOID_P=8 -DHAVE_LIBM=1 -DHAVE_ELF_H=1 -DHAVE_DLFCN_H=1 -DHAVE_DLOPEN=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_LIBPTHREAD=1 -DHAVE_INTTYPES_H=1 -DHAVE_DIRENT_H=1 -DHAVE_WCHAR_H=1 -DSIZEOF_WCHAR_T=4 "# use a consistent INSTALL INSTALL="${SHELL} ${pkgdatadir}/install-sh -c"INSTALL_DATA="${INSTALL} -m 644"INSTALL_PROGRAM="${INSTALL}"INSTALL_SCRIPT="${INSTALL}"LDFLAGS="${RPATHLDFLAGS}"LIBS="-lpthread -ldl -lm "LIB_M=""LIB_VERSION="73.1"LIB_VERSION_MAJOR="73"MKINSTALLDIRS="${SHELL} ${pkgdatadir}/mkinstalldirs"RANLIB="/croot/icu_1692293016303/_build_env/bin/x86_64-conda-linux-gnu-ranlib"RMV="rm -rf"SHELL="/bin/sh"SHLIB_c="${CC} ${DEFS} ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} -shared"SHLIB_cc="${CXX} ${DEFS} ${CPPFLAGS} ${CXXFLAGS} ${LDFLAGS} -shared"U_IS_BIG_ENDIAN="0"includedir="${prefix}/include"infodir="${datarootdir}/info"localstatedir="${prefix}/var"mandir="${datarootdir}/man"oldincludedir="/usr/include"program_transform_name="s,x,x,"sharedstatedir="${prefix}/com"sysconfdir="${prefix}/etc"INSTALL_L="${INSTALL_DATA}"
# for derivative builds - don't bother with VERBOSE/NONVERBOSE SILENT_COMPILE
#################################################################### *5* packaging options and directories###################################################################
# The basename of the ICU data file (i.e. icudt21b )ICUDATA_CHAR="l"ICUDATA_NAME="icudt73l"
# Defaults for pkgdata's mode and directories# The default data dir changes depending on what packaging mode # is being usedif [ "x$PKGDATA_MODE" = "x" ];thenPKGDATA_MODE="dll"fi
case "$PKGDATA_MODE" incommon)ICUDATA_DIR="${pkgdatadir}"ICUPKGDATA_DIR="${ICUDATA_DIR}";;dll)ICUDATA_DIR="${pkgdatadir}"ICUPKGDATA_DIR="${libdir}";;*)ICUDATA_DIR="${pkgdatadir}"ICUPKGDATA_DIR="${ICUDATA_DIR}";;
esac
GENCCODE_ASSEMBLY="-a gcc"
#################################################################### *6* Inclusion of platform make fragment (mh-* file)#################################################################### The mh- file ("make fragment") for the platform is included here. # It may override the above settings.# It is put last so that the mh-file can override anything.# The selfcheck is just a sanity check that this makefile is# parseable. The mh fragment is only included if this does not occur.
# Following from mh-linux## -*-makefile-*-## Copyright (C) 2016 and later: Unicode, Inc. and others.## License & terms of use: http://www.unicode.org/copyright.html## Linux-specific setup## Copyright (c) 1999-2013, International Business Machines Corporation and## others. All Rights Reserved.
## Commands to generate dependency filesGEN_DEPS_c="${CC} -E -MM ${DEFS} ${CPPFLAGS}"GEN_DEPS_cc="${CXX} -E -MM ${DEFS} ${CPPFLAGS} ${CXXFLAGS}"
## Flags for position independent codeSHAREDLIBCFLAGS="-fPIC"SHAREDLIBCXXFLAGS="-fPIC"SHAREDLIBCPPFLAGS="-DPIC"
## Additional flags when building libraries and with threadsTHREADSCPPFLAGS="-D_REENTRANT"LIBCPPFLAGS=""
## Compiler switch to embed a runtime search pathLD_RPATH="-Wl,-zorigin,-rpath,\$\$ORIGIN "LD_RPATH_PRE="-Wl,-rpath,"
## These are the library specific LDFLAGSLDFLAGSICUDT="-nodefaultlibs -nostdlib"
## Compiler switch to embed a library name# The initial tab in the next line is to prevent icu-config from reading it.# We can't depend on MIDDLE_SO_TARGET being set.LD_SONAME=
## Shared library optionsLD_SOOPTIONS="-Wl,-Bsymbolic"
## Shared object suffixSO="so"## Non-shared intermediate object suffixSTATIC_O="ao"
## Compilation rules
## Dependency rules
## Versioned libraries rules
## Bind internal references
# LDflags that pkgdata will useBIR_LDFLAGS="-Wl,-Bsymbolic"
# Dependencies [i.e. map files] for the final libraryBIR_DEPS=""
## Remove shared library 's'STATIC_PREFIX_WHEN_USED=""STATIC_PREFIX=""
## End Linux-specific setup
## -*-sh-*-## BEGIN of icu-config-bottom.## Copyright (C) 2016 and later: Unicode, Inc. and others.## License & terms of use: http://www.unicode.org/copyright.html## Copyright (c) 2002-2013, International Business Machines Corporation and## others. All Rights Reserved.
# For MinGW do we want the common DLL to go into the bin location?if [ "$MINGW_MOVEDLLSTOBINDIR" = "YES" ]; then ICUUC_FILE="${bindir}/${ICULIBS_COMMON_LIB_NAME}"else ICUUC_FILE="${libdir}/${ICULIBS_COMMON_LIB_NAME}"fi
ICUUC_FILE_A="${libdir}/${ICULIBS_COMMON_LIB_NAME_A}"
# echo ENABLE RPATH $ENABLE_RPATH and RPATHLDFLAGS=${RPATH_LDFLAGS}if [ "x$PKGDATA_MODE" = "x" ]; then PKGDATA_MODE=dllfi
}
## The actual code of icu-config goes here.
ME=`basename "$0"`
allflags(){ echo " --noverify Don't verify that ICU is actually installed." echo " --bindir Print binary directory path (bin)" echo " --cc Print C compiler used [CC]" echo " --cflags Print C compiler flags [CFLAGS]" echo " --cflags-dynamic Print additional C flags for" echo " building shared libraries." echo " --cppflags Print C Preprocessor flags [CPPFLAGS]" echo " --cppflags-dynamic Print additional C Preprocessor flags for" echo " building shared libraries." echo " --cppflags-searchpath Print only -I include directives (-Iinclude)" echo " --cxx Print C++ compiler used [CXX]" echo " --cxxflags Print C++ compiler flags [CXXFLAGS]" echo " --cxxflags-dynamic Print additional C++ flags for" echo " building shared libraries." echo " --detect-prefix Attempt to detect prefix based on PATH" echo " --exec-prefix Print prefix for executables (/bin)" echo " --exists Return with 0 status if ICU exists else fail" echo " --help, -?, --usage Print this message" echo " --icudata Print shortname of ICU data file (icudt21l)" echo " --icudata-install-dir Print path to install data to - use as --install option to pkgdata(1)" echo " --icudata-mode Print default ICU pkgdata mode (dll) - use as --mode option to pkgdata(1)." echo " --icudatadir Print path to packaged archive data. Can set as [ICU_DATA]" echo " --invoke Print commands to invoke an ICU program" echo " --invoke=<prog> Print commands to invoke an ICU program named <prog> (ex: genrb)" echo " --ldflags Print -L search path and -l libraries to link with ICU [LDFLAGS]. This is for the data, uc (common), and i18n libraries only. " echo " --ldflags-libsonly Same as --ldflags, but only the -l directives" echo " --ldflags-searchpath Print only -L (search path) directive" echo " --ldflags-system Print only system libs ICU links with (-lpthread, -lm)" echo " --ldflags-icuio Print ICU icuio link directive. Use in addition to --ldflags " echo " --ldflags-obsolete Print ICU obsolete link directive. Use in addition to --ldflags. (requires icuapps/obsolete to be built and installed.) " echo " --mandir Print manpage (man) path" echo " --prefix Print PREFIX to icu install (/usr/local)" echo " --prefix=XXX Set prefix to XXX for remainder of command" echo " --sbindir Print system binary path (sbin) " echo " --shared-datadir Print shared data (share) path. This is NOT the ICU data dir." echo " --shlib-c Print the command to compile and build C shared libraries with ICU" echo " --shlib-cc Print the command to compile and build C++ shared libraries with ICU" echo " --sysconfdir Print system config (etc) path" echo " --unicode-version Print version of Unicode data used in ICU ($UNICODE_VERSION)" echo " --version Print ICU version ($VERSION)" echo " --incfile Print path to Makefile.inc" echo " --incpkgdatafile Print path to pkgdata.inc (for -O option of pkgdata)" echo " --install Print path to install-sh" echo " --mkinstalldirs Print path to mkinstalldirs"}
## Print the normal usage messageshortusage(){ echo "usage: ${ME} " `allflags | cut -c-25 | sed -e 's%.*%[ & ]%'`}
usage(){ echo "${ME}: icu-config: ICU configuration helper script" echo echo "The most commonly used options will be --cflags, --cxxflags, --cppflags, and --ldflags." echo 'Example (in make): CPFLAGS=$(shell icu-config --cppflags)' echo ' LDFLAGS=$(shell icu-config --ldflags)' echo " (etc).." echo echo "Usage:" allflags
echo echo " [Brackets] show MAKE variable equivalents, (parenthesis) show example output" echo echo "Copyright (c) 2002-2013, International Business Machines Corporation and others. All Rights Reserved." echo echo "NOTE: Please consider using the pkg-config (.pc) files instead of icu-config." echo " See: <https://unicode-org.github.io/icu/userguide/howtouseicu> "}
## Check the sanity of current variablessanity(){ if [ ! -f "${ICUUC_FILE}" -a ! -f "${ICUUC_FILE_A}" ] && [ ${IGNORE_ICUUC_FILE_CHECK} = "no" ] && [ ${SANITY} = "sane" ]; then echo "### $ME: Can't find ${ICUUC_FILE} - ICU prefix is wrong." 1>&2 echo "### Try the --prefix= option " 1>&2 echo "### or --detect-prefix" 1>&2 echo "### (If you want to disable this check, use the --noverify option)" 1>&2 echo "### $ME: Exitting." 1>&2 exit 2 fi}
## Main starts here.
if [ $# -lt 1 ]; then shortusage exit 1fi
# For certain options (e.g. --detect-prefix) don't check for icuuc library file.
IGNORE_ICUUC_FILE_CHECK="no";
SANITY="sane"
case "$1" in--noverify) SANITY="nosanity" shift ;;esac
case "$1" in*prefix*) IGNORE_ICUUC_FILE_CHECK="yes" ;;esac
# Load our variables from autoconf# ALWAYS load twice because of dependenciesloaddefsloaddefs
if [ $# -gt 0 -a $1 = "--selfcheck" ];then echo "passed" exit # EXIT for self checkfi
sanity
while [ $# -gt 0 ];do arg="$1" var=`echo $arg | sed -e 's/^[^=]*=//'`# echo "### processing $arg" 1>&2 case "$arg" in
# undocumented. --debug) set -x ;;
--noverify) echo "### $ME: Error: --noverify must be the first argument." 1>&2 exit 1 ;;
--so) echo $SO ;;
--bindir) echo $bindir ;;
--libdir) echo $libdir ;;
--exists) sanity ;;
--sbindir) echo $sbindir ;;
--mkinstalldirs) echo ${MKINSTALLDIRS} ;;
--install) echo ${INSTALL} ;;
--invoke=*) QUOT="\"" CMD="${var}"
# If it's not a locally executable command (1st choice) then # search for it in the ICU directories. if [ ! -x ${CMD} ]; then if [ -x ${bindir}/${var} ]; then CMD="${bindir}/${var}" fi if [ -x ${sbindir}/${var} ]; then CMD="${sbindir}/${var}" fi fi
echo "env ${QUOT}${LDLIBRARYPATH_ENVVAR}=${libdir}:"'${'"${LDLIBRARYPATH_ENVVAR}"'}'${QUOT} ${CMD} ;;
--invoke) QUOT="\"" echo "env ${QUOT}${LDLIBRARYPATH_ENVVAR}=${libdir}:"'${'"${LDLIBRARYPATH_ENVVAR}"'}'${QUOT} ;;
--cflags) echo $ECHO_N "${CFLAGS} ${ECHO_C}" ;;
--cc) echo $ECHO_N "${CC} ${ECHO_C}" ;;
--cxx) echo $ECHO_N "${CXX} ${ECHO_C}" ;;
--cxxflags) echo $ECHO_N "${CXXFLAGS} ${ECHO_C}" ;;
--cppflags) # Don't echo the -I. - it's unneeded. echo $ECHO_N "${CPPFLAGS} ${ECHO_C}" | sed -e 's/-I. //' ;;
--cppflags-searchpath) echo $ECHO_N "-I${prefix}/include ${ECHO_C}" ;;
--cppflags-dynamic) echo $ECHO_N "${SHAREDLIBCPPFLAGS} ${ECHO_C}" ;;
--cxxflags-dynamic) echo $ECHO_N "${SHAREDLIBCXXFLAGS} ${ECHO_C}" ;;
--cflags-dynamic) echo $ECHO_N "${SHAREDLIBCFLAGS} ${ECHO_C}" ;;
--ldflags-system) echo $ECHO_N "${LIBS} ${ECHO_C}" ;;
--ldflags) echo $ECHO_N "${LDFLAGS} ${ICULIBS} ${ECHO_C}"# $RPATH_LDFLAGS ;;
--ldflags-libsonly) echo $ECHO_N "${ICULIBS_I18N} ${ICULIBS_COMMON} ${ICULIBS_DATA} ${ECHO_C}" ;;
--ldflags-icuio) echo $ECHO_N " ${ICULIBS_ICUIO} ${ECHO_C}" ;;
--ldflags-obsolete) echo $ECHO_N "${ICULIBS_OBSOLETE} ${ECHO_C}" ;;
--ldflags-toolutil) echo $ECHO_N " ${ICULIBS_TOOLUTIL} ${ECHO_C}" ;;
--ldflags-layout) echo ${ME}: ERROR: the old layout engine has been removed. use HarfBuzz. exit 1 ;;
--ldflags-searchpath) echo $ECHO_N "-L${libdir} ${ECHO_C}" ;;
--detect-prefix) HERE=`echo $0 | sed -e "s/$ME//g"` if [ -f "${HERE}/../lib/${ICULIBS_COMMON_LIB_NAME}" -o -f "${HERE}/../lib/${ICULIBS_COMMON_LIB_NAME_A}" ]; then prefix="${HERE}/.." echo "## Using --prefix=${prefix}" 1>&2 fi loaddefs loaddefs ;;
--exec-prefix) echo $exec_prefix ;;
--prefix) echo $prefix ;;
--prefix=*) prefix=$var loaddefs loaddefs ;;
--sysconfdir) echo $sysconfdir ;;
--mandir) echo $mandir ;;
--shared-datadir) echo $ECHO_N "${datadir} ${ECHO_C}" ;;
--incfile) echo $ECHO_N "${pkglibdir}/Makefile.inc ${ECHO_C}" ;;
--incpkgdatafile) echo $ECHO_N "${pkglibdir}/pkgdata.inc ${ECHO_C}" ;;
--icudata) echo $ECHO_N "${ICUDATA_NAME} ${ECHO_C}" ;;
--icudata-mode) echo $ECHO_N "${PKGDATA_MODE} ${ECHO_C}" ;;
--icudata-install-dir) echo $ECHO_N "${ICUPKGDATA_DIR} ${ECHO_C}" ;;
--icudatadir) echo $ECHO_N "${ICUDATA_DIR} ${ECHO_C}" ;;
--shlib-c) echo $ECHO_N "${SHLIB_c} ${ECHO_C}" ;;
--shlib-cc) echo $ECHO_N "${SHLIB_cc} ${ECHO_C}" ;;
--version) echo $ECHO_N $VERSION ;;
--unicode-version) echo $ECHO_N $UNICODE_VERSION ;;
--host) echo $host exit 0 ;;
--help) usage exit 0 ;;
--usage) usage exit 0 ;;
# --enable-rpath=*)# ENABLE_RPATH=$var# loaddefs# ;;
-?) usage exit 0 ;;
*) echo ${ME}: ERROR Unknown Option $arg 1>&2 echo 1>&2 shortusage 1>&2 echo "### $ME: Exitting." 1>&2 exit 1; ;; esac shift
# Reset the ignore icuuc file check flag if [ $IGNORE_ICUUC_FILE_CHECK = "yes" ]; then IGNORE_ICUUC_FILE_CHECK="no" sanity fidoneecho# Check once before we quit (will check last used prefix)sanity## END of icu-config-bottom
exit 0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240#!/home/zangyihe/miniconda3/bin/perl eval 'exec /home/zangyihe/miniconda3/bin/perl -S $0 ${1+"$@"}' if $running_under_some_shell;#!/usr/bin/perl
BEGIN { pop @INC if $INC[-1] eq '.' }use strict;use Getopt::Long;use Encode ();
use JSON::PP ();
# imported from JSON-XS/bin/json_xs
my %allow_json_opt = map { $_ => 1 } qw( ascii latin1 utf8 pretty indent space_before space_after relaxed canonical allow_nonref allow_singlequote allow_barekey allow_bignum loose escape_slash indent_length);
GetOptions( 'v' => \( my $opt_verbose ), 'f=s' => \( my $opt_from = 'json' ), 't=s' => \( my $opt_to = 'json' ), 'json_opt=s' => \( my $json_opt = 'pretty' ), 'V' => \( my $version ),) or die "Usage: $0 [-V] [-f from_format] [-t to_format] [-json_opt options_to_json1[,options_to_json2[,...]]]\n";
if ( $version ) { print "$JSON::PP::VERSION\n"; exit;}
$json_opt = '' if $json_opt eq '-';
my %json_opt;for my $opt (split /,/, $json_opt) { my ($key, $value) = split /=/, $opt, 2; $value = 1 unless defined $value; die "'$_' is not a valid json option" unless $allow_json_opt{$key}; $json_opt{$key} = $value;}
my %F = ( 'json' => sub { my $json = JSON::PP->new; my $enc = /^\x00\x00\x00/s ? "utf-32be" : /^\x00.\x00/s ? "utf-16be" : /^.\x00\x00\x00/s ? "utf-32le" : /^.\x00.\x00/s ? "utf-16le" : "utf-8"; for my $key (keys %json_opt) { next if $key eq 'utf8'; $json->$key($json_opt{$key}); } $json->decode( Encode::decode($enc, $_) ); }, 'eval' => sub { my $v = eval "no strict;\n#line 1 \"input\"\n$_"; die "$@" if $@; return $v; },);
my %T = ( 'null' => sub { "" }, 'json' => sub { my $json = JSON::PP->new->utf8; for my $key (keys %json_opt) { $json->$key($json_opt{$key}); } $json->canonical if $json_opt{pretty}; $json->encode( $_ ); }, 'dumper' => sub { require Data::Dumper; local $Data::Dumper::Terse = 1; local $Data::Dumper::Indent = 1; local $Data::Dumper::Useqq = 1; local $Data::Dumper::Quotekeys = 0; local $Data::Dumper::Sortkeys = 1; Data::Dumper::Dumper($_) },);
$F{$opt_from} or die "$opt_from: not a valid fromformat\n";
$T{$opt_to} or die "$opt_from: not a valid toformat\n";
{ local $/; binmode STDIN; $_ = <STDIN>;}
$_ = $F{$opt_from}->();$_ = $T{$opt_to}->();
print $_;
__END__
=pod
=encoding utf8
=head1 NAME
json_pp - JSON::PP command utility
=head1 SYNOPSIS
json_pp [-v] [-f from_format] [-t to_format] [-json_opt options_to_json1[,options_to_json2[,...]]]
=head1 DESCRIPTION
json_pp converts between some input and output formats (one of them is JSON).This program was copied from L<json_xs> and modified.
The default input format is json and the default output format is json with pretty option.
=head1 OPTIONS
=head2 -f
-f from_format
Reads a data in the given format from STDIN.
Format types:
=over
=item json
as JSON
=item eval
as Perl code
=back
=head2 -t
Writes a data in the given format to STDOUT.
=over
=item null
no action.
=item json
as JSON
=item dumper
as Data::Dumper
=back
=head2 -json_opt
options to JSON::PP
Acceptable options are:
ascii latin1 utf8 pretty indent space_before space_after relaxed canonical allow_nonref allow_singlequote allow_barekey allow_bignum loose escape_slash indent_length
Multiple options must be separated by commas:
Right: -json_opt pretty,canonical
Wrong: -json_opt pretty -json_opt canonical
=head2 -v
Verbose option, but currently no action in fact.
=head2 -V
Prints version and exits.
=head1 EXAMPLES
$ perl -e'print q|{"foo":"あい","bar":1234567890000000000000000}|' |\ json_pp -f json -t dumper -json_opt pretty,utf8,allow_bignum $VAR1 = { 'bar' => bless( { 'value' => [ '0000000', '0000000', '5678900', '1234' ], 'sign' => '+' }, 'Math::BigInt' ), 'foo' => "\x{3042}\x{3044}" };
$ perl -e'print q|{"foo":"あい","bar":1234567890000000000000000}|' |\ json_pp -f json -t dumper -json_opt pretty $VAR1 = { 'bar' => '1234567890000000000000000', 'foo' => "\x{e3}\x{81}\x{82}\x{e3}\x{81}\x{84}" };
=head1 SEE ALSO
L<JSON::PP>, L<json_xs>
=head1 AUTHOR
Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt>
=head1 COPYRIGHT AND LICENSE
Copyright 2010 by Makamaka Hannyaharamitu
This library is free software; you can redistribute it and/or modifyit under the same terms as Perl itself.
=cut
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220#!/bin/sh# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 1998, 2002, 2006, 2007 Free Software Foundation# Copyright (C) 1993 Jean-loup Gailly
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
# This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.
# This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.
#SET_PATH - This line is a placeholder to ease patching this script.
# Instead of unsetting XZ_OPT, just make sure that xz will use file format# autodetection. This way memory usage limit and thread limit can be# specified via XZ_OPT. With gzip, bzip2, and lzop it's OK to just unset the# environment variables.xz='xz --format=auto'unset GZIP BZIP BZIP2 LZOP
case ${0##*/} in *cmp*) prog=xzcmp; cmp=${CMP:-cmp};; *) prog=xzdiff; cmp=${DIFF:-diff};;esac
version="$prog (XZ Utils) 5.6.4"
usage="Usage: ${0##*/} [OPTION]... FILE1 [FILE2]Compare FILE1 to FILE2, using their uncompressed contents if they arecompressed. If FILE2 is omitted, then the files compared are FILE1 andFILE1 from which the compression format suffix has been stripped.
Do comparisons like '$cmp' does. OPTIONs are the same as for '$cmp'.
Report bugs to <xz@tukaani.org>."
# sed script to escape all ' for the shell, and then (to handle trailing# newlines correctly) turn trailing X on last line into '.escape=' s/'\''/'\''\\'\'''\''/g $s/X$/'\''/'
while :; do case $1 in --h*) printf '%s\n' "$usage" || exit 2; exit;; --v*) printf '%s\n' "$version" || exit 2; exit;; --) shift; break;; -*\'*) cmp="$cmp '"`printf '%sX\n' "$1" | sed "$escape"`;; -?*) cmp="$cmp '$1'";; *) break;; esac shiftdonecmp="$cmp --"
for file; do test "X$file" = X- || <"$file" || exit 2done
# xz needs -qQ to ignore warnings like unsupported check type.xz1="$xz -qQ"xz2="$xz -qQ"xz_status=0exec 3>&1
if test $# -eq 1; then case $1 in *[-.]xz | *[-.]lzma | *[-.]lz | *.t[lx]z) ;; *[-.]bz2 | *.tbz | *.tbz2) xz1=bzip2;; *[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz1=gzip;; *[-.]lzo | *.tzo) xz1=lzop;; *[-.]zst | *.tzst) xz1='zstd -q';; *[-.]lz4) xz1=lz4;; *) printf '%s\n' "$0: $1: Unknown compressed file name suffix" >&2 exit 2;; esac case $1 in *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *[-.]lzo | *[-.]zst | *[-.]lz4) FILE=`expr "X$1" : 'X\(.*\)[-.][abglmostxzZ24]*$'`;; *.t[abglx]z) FILE=`expr "X$1" : 'X\(.*[-.]t\)[abglx]z$'`ar;; *.tbz2) FILE=`expr "X$1" : 'X\(.*[-.]t\)bz2$'`ar;; *.tzo) FILE=`expr "X$1" : 'X\(.*[-.]t\)zo$'`ar;; *.tzst) FILE=`expr "X$1" : 'X\(.*[-.]t\)zst$'`ar;; esac xz_status=$( exec 4>&1 ($xz1 -cd -- "$1" 4>&-; echo $? >&4) 3>&- | eval "$cmp" - '"$FILE"' >&3 )elif test $# -eq 2; then case $1 in *[-.]bz2 | *.tbz | *.tbz2) xz1=bzip2;; *[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz1=gzip;; *[-.]lzo | *.tzo) xz1=lzop;; *[-.]zst | *.tzst) xz1='zstd -q';; *[-.]lz4) xz1=lz4;; esac case $2 in *[-.]bz2 | *.tbz | *.tbz2) xz2=bzip2;; *[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz2=gzip;; *[-.]lzo | *.tzo) xz2=lzop;; *[-.]zst | *.tzst) xz2='zstd -q';; *[-.]lz4) xz2=lz4;; esac case $1 in *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | *[-.]lz4 | -) case "$2" in *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | *[-.]lz4 | -) if test "$1$2" = --; then xz_status=$( exec 4>&1 ($xz1 -cdf - 4>&-; echo $? >&4) 3>&- | eval "$cmp" - - >&3 ) elif # Reject Solaris 8's buggy /bin/bash 2.03. echo X | (echo X | eval "$cmp" /dev/fd/5 - >/dev/null 2>&1) 5<&0; then # NOTE: xz_status will contain two numbers. xz_status=$( exec 4>&1 ($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- | ( ($xz2 -cdf -- "$2" 4>&-; echo $? >&4) 3>&- 5<&- </dev/null | eval "$cmp" /dev/fd/5 - >&3) 5<&0 ) else F=`expr "/$2" : '.*/\(.*\)[-.][ablmotxz2]*$'` || F=$prog tmp= trap ' test -n "$tmp" && rm -rf "$tmp" (exit 2); exit 2 ' HUP INT PIPE TERM 0 if type mktemp >/dev/null 2>&1; then # Note that FreeBSD's mktemp isn't fully compatible with # the implementations from mktemp.org and GNU coreutils. # It is important that the -t argument is the last argument # and that no "--" is used between -t and the template argument. # This way this command works on all implementations. tmp=`mktemp -d -t "$prog.XXXXXXXXXX"` || exit 2 else # Fallback code if mktemp is missing. This isn't as # robust as using mktemp since this doesn't try with # different file names in case of a file name conflict. # # There's no need to save the original umask since # we don't create any non-temp files. Note that using # mkdir -m 0077 isn't secure since some mkdir implementations # create the dir with the default umask and chmod the # the dir afterwards. umask 0077 mkdir -- "${TMPDIR-/tmp}/$prog.$$" || exit 2 tmp="${TMPDIR-/tmp}/$prog.$$" fi $xz2 -cdf -- "$2" > "$tmp/$F" || exit 2 xz_status=$( exec 4>&1 ($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- | eval "$cmp" - '"$tmp/$F"' >&3 ) cmp_status=$? rm -rf "$tmp" || xz_status=$? trap - HUP INT PIPE TERM 0 (exit $cmp_status) fi;; *) xz_status=$( exec 4>&1 ($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- | eval "$cmp" - '"$2"' >&3 );; esac;; *) case "$2" in *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | *[-.]lz4 | -) xz_status=$( exec 4>&1 ($xz2 -cdf -- "$2" 4>&-; echo $? >&4) 3>&- | eval "$cmp" '"$1"' - >&3 );; *) eval "$cmp" '"$1"' '"$2"';; esac;; esacelse printf '%s\n' "$0: Invalid number of operands; try '${0##*/} --help' for help" >&2 exit 2fi
cmp_status=$?for num in $xz_status ; do # 0 from decompressor means successful decompression. SIGPIPE from # decompressor is possible when diff or cmp exits before the whole file # has been decompressed. In that case we want to retain the exit status # from diff or cmp. Note that using "trap '' PIPE" is not possible # because gzip changes its behavior (including exit status) if SIGPIPE # is ignored. test "$num" -eq 0 && continue test "$num" -ge 128 \ && test "$(kill -l "$num" 2> /dev/null)" = "PIPE" \ && continue exit 2doneexit $cmp_status123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300#!/bin/sh# SPDX-License-Identifier: GPL-2.0-or-later
# xzgrep -- a wrapper around a grep program that decompresses files as needed# Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca>
# Copyright (C) 1998, 2001, 2002, 2006, 2007 Free Software Foundation# Copyright (C) 1993 Jean-loup Gailly
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
# This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.
# This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.
#SET_PATH - This line is a placeholder to ease patching this script.
# Instead of unsetting XZ_OPT, just make sure that xz will use file format# autodetection. This way memory usage limit and thread limit can be# specified via XZ_OPT. With gzip, bzip2, and lzop it's OK to just unset the# environment variables.xz='xz --format=auto'unset GZIP BZIP BZIP2 LZOP
case ${0##*/} in *egrep*) prog=xzegrep; grep=${GREP:-grep -E};; *fgrep*) prog=xzfgrep; grep=${GREP:-grep -F};; *) prog=xzgrep; grep=${GREP:-grep};;esac
version="$prog (XZ Utils) 5.6.4"
usage="Usage: ${0##*/} [OPTION]... [-e] PATTERN [FILE]...Look for instances of PATTERN in the input FILEs, using theiruncompressed contents if they are compressed.
OPTIONs are the same as for '$grep'.
Report bugs to <xz@tukaani.org>."
# sed script to escape all ' for the shell, and then (to handle trailing# newlines correctly) turn trailing X on last line into '.escape=' s/'\''/'\''\\'\'''\''/g $s/X$/'\''/'operands=have_pat=0files_with_matches=0files_without_matches=0no_filename=0with_filename=0
# See if -H and --label options are supported (GNU and *BSDs).if test f:x = "$(eval "echo x | $grep -H --label=f x 2> /dev/null")"; then grep_supports_label=1else grep_supports_label=0fi
while test $# -ne 0; do option=$1 shift optarg=
case $option in (-[0123456789abcdEFGhHiIKlLnoPqrRsTuUvVwxyzZ]*[!0123456789]*) # Something like -Fiv was specified, that is, $option contains more # than one option of which the first option (in this example -F) # doesn't take an argument. Split the first option into a standalone # argument and continue parsing the rest of the options (in this example, # replace -Fiv with -iv in the argument list and set option=-F). # # If there are digits [0-9] they are treated as if they were a single # option character because this syntax is an alias for -C for GNU grep. # For example, "grep -25F" is equivalent to "grep -C25 -F". If only # digits are specified like "grep -25" we don't get here because the # above pattern in the case-statement doesn't match such strings. arg2=-\'$(LC_ALL=C expr "X${option}X" : 'X-.[0-9]*\(.*\)' | LC_ALL=C sed "$escape") eval "set -- $arg2 "'${1+"$@"}' option=$(LC_ALL=C expr "X$option" : 'X\(-.[0-9]*\)');; (--binary-*=* | --[lm]a*=* | --reg*=*) # These options require an argument and an argument has been provided # with the --foo=argument syntax. All is good. ;; (-[ABCDefmX] | --binary-* | --file | --[lm]a* | --reg*) # These options require an argument which should now be in $1. # If it isn't, display an error and exit. case ${1?"$option option requires an argument"} in (*\'*) optarg=" '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");; (*) optarg=" '$1'";; esac shift;; (--) break;; (-?*) ;; (*) case $option in (*\'*) operands="$operands '"$(printf '%sX\n' "$option" | LC_ALL=C sed "$escape");; (*) operands="$operands '$option'";; esac ${POSIXLY_CORRECT+break} continue;; esac
case $option in (-[drRzZ] | --di* | --exc* | --inc* | --rec* | --nu*) printf >&2 '%s: %s: Option not supported\n' "$0" "$option" exit 2;; (-[ef]* | --file | --file=* | --reg*) have_pat=1;; (--h | --he | --hel | --help) printf '%s\n' "$usage" || exit 2 exit;; (-H | --wi | --wit | --with | --with- | --with-f | --with-fi \ | --with-fil | --with-file | --with-filen | --with-filena | --with-filenam \ | --with-filename) with_filename=1 continue;; (-l | --files-with-*) files_with_matches=1 continue;; (-L | --files-witho*) files_without_matches=1 continue;; (-h | --no-f*) no_filename=1;; (-V | --v | --ve | --ver | --vers | --versi | --versio | --version) printf '%s\n' "$version" || exit 2 exit;; esac
case $option in (*\'?*) option=\'$(printf '%sX\n' "$option" | LC_ALL=C sed "$escape");; (*) option="'$option'";; esac
grep="$grep $option$optarg"done
eval "set -- $operands "'${1+"$@"}'
if test $have_pat -eq 0; then case ${1?"Missing pattern; try '${0##*/} --help' for help"} in (*\'*) grep="$grep -e '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");; (*) grep="$grep -e '$1'";; esac shiftfi
if test $# -eq 0; then set -- -fi
exec 3>&1
# res=1 means that no file matched yetres=1
for i; do case $i in *[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) uncompress="gzip -cdf";; *[-.]bz2 | *[-.]tbz | *.tbz2) uncompress="bzip2 -cdf";; *[-.]lzo | *[-.]tzo) uncompress="lzop -cdf";; *[-.]zst | *[-.]tzst) uncompress="zstd -cdfq";; # zstd needs -q. *[-.]lz4) uncompress="lz4 -cdf";; *) uncompress="$xz -cdfqQ";; # -qQ to ignore warnings like unsupp. check. esac # xz_status will hold the decompressor's exit status. # Exit status of grep (and in rare cases, printf or sed) is # available as the exit status of this assignment command. xz_status=$( exec 5>&1 ($uncompress -- "$i" 5>&-; echo $? >&5) 3>&- | if test $files_with_matches -eq 1; then eval "$grep -q" && { printf '%s\n' "$i" || exit 2; } elif test $files_without_matches -eq 1; then eval "$grep -q" || { r=$? if test $r -eq 1; then printf '%s\n' "$i" || r=2 fi exit $r } elif test $with_filename -eq 0 && { test $# -eq 1 || test $no_filename -eq 1; }; then eval "$grep" elif test $grep_supports_label -eq 1; then # The grep implementation in use allows us to specify the filename # that grep will prefix to the output lines. This is faster and # less prone to security bugs than the fallback method that uses sed. # This also avoids confusing output with GNU grep >= 3.5 (2020-09-27) # which prints "binary file matches" to stderr instead of stdout. # # If reading from stdin, let grep use whatever name it prefers for # stdin. With GNU grep it is a locale-specific translated string. if test "x$i" = "x-"; then eval "$grep -H" else eval "$grep -H --label \"\$i\"" fi else # Append a colon so that the last character will never be a newline # which would otherwise get lost in shell command substitution. i="$i:"
# Escape & \ | and newlines only if such characters are present # (speed optimization). case $i in (*''* | *'&'* | *'\'* | *'|'*) # If sed fails, set i to a known safe string to ensure that # failing sed did not create a half-escaped dangerous string. i=$(printf '%s\n' "$i" | LC_ALL=C sed 's/[&\|]/\\&/g; $!s/$/\\/') || i='(unknown filename):';; esac
# $i already ends with a colon so do not add it here. sed_script="s|^|$i|"
# If grep or sed fails, pick the larger value of the two exit statuses. # If sed fails, use at least 2 since we use >= 2 to indicate errors. r=$( exec 4>&1 (eval "$grep" 4>&-; echo $? >&4) 3>&- | LC_ALL=C sed "$sed_script" >&3 4>&- ) || { sed_status=$? test "$sed_status" -lt 2 && sed_status=2 test "$r" -lt "$sed_status" && r=$sed_status } exit $r fi >&3 5>&- ) r=$?
# If grep or sed or other non-decompression command failed with a signal, # exit immediately and ignore the possible remaining files. # # NOTE: Instead of 128 + signal_number, some shells use # 256 + signal_number (ksh) or 384 + signal_number (yash). # This is fine for us since their "exit" and "kill -l" commands take # this into account. (At least the versions I tried do but there is # a report of an old ksh variant whose "exit" truncates the exit status # to 8 bits without any special handling for values indicating a signal.) test "$r" -ge 128 && exit "$r"
if test -z "$xz_status"; then # Something unusual happened, for example, we got a signal and # the exit status of the decompressor was never echoed and thus # $xz_status is empty. Exit immediately and ignore the possible # remaining files. exit 2 elif test "$xz_status" -ge 128; then # The decompressor died due to a signal. SIGPIPE is ignored since it can # occur if grep exits before the whole file has been decompressed (grep -q # can do that). If the decompressor died with some other signal, exit # immediately and ignore the possible remaining files. test "$(kill -l "$xz_status" 2> /dev/null)" != "PIPE" && exit "$xz_status" elif test "$xz_status" -gt 0; then # Decompression failed but we will continue with the remaining # files anyway. Set exit status to at least 2 to indicate an error. test "$r" -lt 2 && r=2 fi
# Since res=1 is the initial value, we only need to care about # matches (r == 0) and errors (r >= 2) here; r == 1 can be ignored. if test "$r" -ge 2; then # An error occurred in decompressor, grep, or some other command. Update # res unless a larger error code has been seen with an earlier file. test "$res" -lt "$r" && res=$r elif test "$r" -eq 0; then # grep found a match and no errors occurred. Update res if no errors have # occurred with earlier files. test "$res" -eq 1 && res=0 fidone
# 0: At least one file matched and no errors occurred.# 1: No matches were found and no errors occurred.# >=2: Error. It's unknown if matches were found.exit "$res"1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980#!/bin/sh# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2001, 2002, 2007 Free Software Foundation# Copyright (C) 1992, 1993 Jean-loup Gailly
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
# This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.
# This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.
#SET_PATH - This line is a placeholder to ease patching this script.
# Instead of unsetting XZ_OPT, just make sure that xz will use file format# autodetection. This way memory usage limit and thread limit can be# specified via XZ_OPT.xz='xz --format=auto'
version='xzmore (XZ Utils) 5.6.4'
usage="Usage: ${0##*/} [OPTION]... [FILE]...Like 'more', but operate on the uncompressed contents of xz compressed FILEs.
Report bugs to <xz@tukaani.org>."
case $1 in --help) printf '%s\n' "$usage" || exit 2; exit;; --version) printf '%s\n' "$version" || exit 2; exit;;esac
oldtty=`stty -g 2>/dev/null`if stty -cbreak 2>/dev/null; then cb='cbreak'; ncb='-cbreak'else # 'stty min 1' resets eof to ^a on both SunOS and SysV! cb='min 1 -icanon'; ncb='icanon eof ^d'fiif test $? -eq 0 && test -n "$oldtty"; then trap 'stty $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15else trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15fi
if test $# = 0; then if test -t 0; then printf '%s\n' "$usage"; exit 1 else $xz -cdfqQ | eval "${PAGER:-more}" fielse FIRST=1 for FILE; do < "$FILE" || continue if test $FIRST -eq 0; then printf "%s--More--(Next file: %s)" "" "$FILE" stty $cb -echo 2>/dev/null ANS=`dd bs=1 count=1 2>/dev/null` stty $ncb echo 2>/dev/null echo " " case "$ANS" in [eq]) exit;; esac fi if test "$ANS" != 's'; then printf '%s\n' "------> $FILE <------" $xz -cdfqQ -- "$FILE" | eval "${PAGER:-more}" fi if test -t 1; then FIRST=0 fi donefi1234567#!/home/zangyihe/miniconda3/bin/python3.13import sysfrom nvitop.select import mainif __name__ == '__main__': if sys.argv[0].endswith('.exe'): sys.argv[0] = sys.argv[0][:-4] sys.exit(main())123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518#!/home/zangyihe/miniconda3/bin/perl eval 'exec /home/zangyihe/miniconda3/bin/perl -S $0 ${1+"$@"}' if $running_under_some_shell;
my $config_tag1 = '5.32.1 - Sat Dec 23 05:44:15 UTC 2023';
my $patchlevel_date = 1610211291;my @patches = Config::local_patches();my $patch_tags = join "", map /(\S+)/ ? "+$1 " : (), @patches;
BEGIN { pop @INC if $INC[-1] eq '.' }use warnings;use strict;use Config;use File::Spec; # keep perlbug Perl 5.005 compatibleuse Getopt::Std;use File::Basename 'basename';
$Getopt::Std::STANDARD_HELP_VERSION = 1;
sub paraprint;
BEGIN { eval { require Mail::Send;}; $::HaveSend = ($@ eq ""); eval { require Mail::Util; } ; $::HaveUtil = ($@ eq ""); # use secure tempfiles wherever possible eval { require File::Temp; }; $::HaveTemp = ($@ eq ""); eval { require Module::CoreList; }; $::HaveCoreList = ($@ eq ""); eval { require Text::Wrap; }; $::HaveWrap = ($@ eq "");};
our $VERSION = "1.42";
#TODO:# make sure failure (transmission-wise) of Mail::Send is accounted for.# (This may work now. Unsure of the original author's issue -JESSE 2008-06-08)# - Test -b option
my( $file, $usefile, $cc, $address, $thanksaddress, $filename, $messageid, $domain, $subject, $from, $verbose, $ed, $outfile, $fh, $me, $body, $andcc, %REP, $ok, $thanks, $progname, $Is_MSWin32, $Is_Linux, $Is_VMS, $Is_OpenBSD, $report_about_module, $category, $severity, %opt, $have_attachment, $attachments, $has_patch, $mime_boundary);
my $running_noninteractively = !-t STDIN;
my $perl_version = $^V ? sprintf("%vd", $^V) : $];
my $config_tag2 = "$perl_version - $Config{cf_time}";
Init();
if ($opt{h}) { Help(); exit; }if ($opt{d}) { Dump(*STDOUT); exit; }if ($running_noninteractively && !$opt{t} && !($ok and not $opt{n})) { paraprint <<"EOF";Please use $progname interactively. If you want toinclude a file, you can use the -f switch.EOF die "\n";}
Query();Edit() unless $usefile || ($ok and not $opt{n});NowWhat();if ($address) { Send(); if ($thanks) { print "\nThank you for taking the time to send a thank-you message!\n\n";
paraprint <<EOFPlease note that mailing lists are moderated, your message may take a while toshow up.EOF } else { print "\nThank you for taking the time to file a bug report!\n\n";
paraprint <<EOFPlease note that mailing lists are moderated, your message may take a while toshow up. Please consider submitting your report directly to the issue trackerat https://github.com/Perl/perl5/issuesEOF }
} else { save_message_to_disk($outfile);}
exit;
sub ask_for_alternatives { # (category|severity) my $name = shift; my %alts = ( 'category' => { 'default' => 'core', 'ok' => 'install', # Inevitably some of these will end up in RT whatever we do: 'thanks' => 'thanks', 'opts' => [qw(core docs install library utilities)], # patch, notabug }, 'severity' => { 'default' => 'low', 'ok' => 'none', 'thanks' => 'none', 'opts' => [qw(critical high medium low wishlist none)], # zero }, ); die "Invalid alternative ($name) requested\n" unless grep(/^$name$/, keys %alts); my $alt = ""; my $what = $ok || $thanks; if ($what) { $alt = $alts{$name}{$what}; } else { my @alts = @{$alts{$name}{'opts'}}; print "\n\n"; paraprint <<EOF;Please pick a $name from the following list:
@altsEOF my $err = 0; do { if ($err++ > 5) { die "Invalid $name: aborting.\n"; } $alt = _prompt('', "\u$name", $alts{$name}{'default'}); $alt ||= $alts{$name}{'default'}; } while !((($alt) = grep(/^$alt/i, @alts))); } lc $alt;}
sub HELP_MESSAGE { Help(); exit; }sub VERSION_MESSAGE { print "perlbug version $VERSION\n"; }
sub Init { # -------- Setup --------
$Is_MSWin32 = $^O eq 'MSWin32'; $Is_VMS = $^O eq 'VMS'; $Is_Linux = lc($^O) eq 'linux'; $Is_OpenBSD = lc($^O) eq 'openbsd';
# Thanks address $thanksaddress = 'perl-thanks@perl.org';
# Defaults if getopts fails. $outfile = (basename($0) =~ /^perlthanks/i) ? "perlthanks.rep" : "perlbug.rep"; $cc = $::Config{'perladmin'} || $::Config{'cf_email'} || $::Config{'cf_by'} || '';
HELP_MESSAGE() unless getopts("Adhva:s:b:f:F:r:e:SCc:to:n:T:p:", \%opt);
# This comment is needed to notify metaconfig that we are # using the $perladmin, $cf_by, and $cf_time definitions. # -------- Configuration ---------
if (basename ($0) =~ /^perlthanks/i) { # invoked as perlthanks $opt{T} = 1; $opt{C} = 1; # don't send a copy to the local admin }
if ($opt{T}) { $thanks = 'thanks'; } $progname = $thanks ? 'perlthanks' : 'perlbug'; # Target address $address = $opt{a} || ($thanks ? $thanksaddress : "");
# Users address, used in message and in From and Reply-To headers $from = $opt{r} || "";
# Include verbose configuration information $verbose = $opt{v} || 0;
# Subject of bug-report message $subject = $opt{s} || "";
# Send a file $usefile = ($opt{f} || 0);
# File to send as report $file = $opt{f} || "";
# We have one or more attachments $have_attachment = ($opt{p} || 0); $mime_boundary = ('-' x 12) . "$VERSION.perlbug" if $have_attachment;
# Comma-separated list of attachments $attachments = $opt{p} || ""; $has_patch = 0; # TBD based on file type
for my $attachment (split /\s*,\s*/, $attachments) { unless (-f $attachment && -r $attachment) { die "The attachment $attachment is not a readable file: $!\n"; } $has_patch = 1 if $attachment =~ m/\.(patch|diff)$/; }
# File to output to $outfile = $opt{F} || "$progname.rep";
# Body of report $body = $opt{b} || ""; # Editor $ed = $opt{e} || $ENV{VISUAL} || $ENV{EDITOR} || $ENV{EDIT} || ($Is_VMS && "edit/tpu") || ($Is_MSWin32 && "notepad") || "vi";
# Not OK - provide build failure template by finessing OK report if ($opt{n}) { if (substr($opt{n}, 0, 2) eq 'ok' ) { $opt{o} = substr($opt{n}, 1); } else { Help(); exit(); } }
# OK - send "OK" report for build on this system $ok = ''; if ($opt{o}) { if ($opt{o} eq 'k' or $opt{o} eq 'kay') { my $age = time - $patchlevel_date; if ($opt{o} eq 'k' and $age > 60 * 24 * 60 * 60 ) { my $date = localtime $patchlevel_date; print <<"EOF";"perlbug -ok" and "perlbug -nok" do not report on Perl versions whichare more than 60 days old. This Perl version was constructed on$date. If you really want to report this, use"perlbug -okay" or "perlbug -nokay".EOF exit(); } # force these options unless ($opt{n}) { $opt{S} = 1; # don't prompt for send $opt{b} = 1; # we have a body $body = "Perl reported to build OK on this system.\n"; } $opt{C} = 1; # don't send a copy to the local admin $opt{s} = 1; # we have a subject line $subject = ($opt{n} ? 'Not ' : '') . "OK: perl $perl_version ${patch_tags}on" ." $::Config{'archname'} $::Config{'osvers'} $subject"; $ok = 'ok'; } else { Help(); exit(); } }
# Possible administrator addresses, in order of confidence # (Note that cf_email is not mentioned to metaconfig, since # we don't really want it. We'll just take it if we have to.) # # This has to be after the $ok stuff above because of the way # that $opt{C} is forced. $cc = $opt{C} ? "" : ( $opt{c} || $::Config{'perladmin'} || $::Config{'cf_email'} || $::Config{'cf_by'} );
if ($::HaveUtil) { $domain = Mail::Util::maildomain(); } elsif ($Is_MSWin32) { $domain = $ENV{'USERDOMAIN'}; } else { require Sys::Hostname; $domain = Sys::Hostname::hostname(); }
# Message-Id - rjsf $messageid = "<$::Config{'version'}_${$}_".time."\@$domain>";
# My username $me = $Is_MSWin32 ? $ENV{'USERNAME'} : $^O eq 'os2' ? $ENV{'USER'} || $ENV{'LOGNAME'} : eval { getpwuid($<) }; # May be missing
$from = $::Config{'cf_email'} if !$from && $::Config{'cf_email'} && $::Config{'cf_by'} && $me && ($me eq $::Config{'cf_by'});} # sub Init
sub Query { # Explain what perlbug is unless ($ok) { if ($thanks) { paraprint <<'EOF';This program provides an easy way to send a thank-you message back to theauthors and maintainers of perl.
If you wish to generate a bug report, please run it without the -T flag(or run the program perlbug rather than perlthanks)EOF } else { paraprint <<"EOF";This program provides an easy way to generate a bug report for the coreperl distribution (along with tests or patches). To send a thank-younote to $thanksaddress instead of a bug report, please run 'perlthanks'.
The GitHub issue tracker at https://github.com/Perl/perl5/issues is thebest place to submit your report so it can be tracked and resolved.
Please do not use $0 to report bugs in perl modules from CPAN.
Suggestions for how to find help using Perl can be found athttps://perldoc.perl.org/perlcommunity.htmlEOF } }
# Prompt for subject of message, if needed if ($subject && TrivialSubject($subject)) { $subject = ''; }
unless ($subject) { print "First of all, please provide a subject for the report.\n"; if ( not $thanks) { paraprint <<EOF;This should be a concise description of your bug or problemwhich will help the volunteers working to improve perl to categorizeand resolve the issue. Be as specific and descriptive asyou can. A subject like "perl bug" or "perl problem" will make itmuch less likely that your issue gets the attention it deserves.EOF }
my $err = 0; do { $subject = _prompt('','Subject'); if ($err++ == 5) { if ($thanks) { $subject = 'Thanks for Perl'; } else { die "Aborting.\n"; } } } while (TrivialSubject($subject)); } $subject = '[PATCH] ' . $subject if $has_patch && ($subject !~ m/^\[PATCH/i);
# Prompt for return address, if needed unless ($opt{r}) { # Try and guess return address my $guess;
$guess = $ENV{'REPLY-TO'} || $ENV{'REPLYTO'} || $ENV{'EMAIL'} || $from || '';
unless ($guess) { # move $domain to where we can use it elsewhere if ($domain) { if ($Is_VMS && !$::Config{'d_socket'}) { $guess = "$domain\:\:$me"; } else { $guess = "$me\@$domain" if $domain; } } }
if ($guess) { unless ($ok) { paraprint <<EOF;Perl's developers may need your email address to contact you forfurther information about your issue or to inform you when it isresolved. If the default shown is not your email address, pleasecorrect it.EOF } } else { paraprint <<EOF;Please enter your full internet email address so that Perl'sdevelopers can contact you with questions about your issue or toinform you that it has been resolved.EOF }
if ($ok && $guess) { # use it $from = $guess; } else { # verify it $from = _prompt('','Your address',$guess); $from = $guess if $from eq ''; } }
if ($from eq $cc or $me eq $cc) { # Try not to copy ourselves $cc = "yourself"; }
# Prompt for administrator address, unless an override was given if( $address and !$opt{C} and !$opt{c} ) { my $description = <<EOF;$0 can send a copy of this report to your local perladministrator. If the address below is wrong, please correct it,or enter 'none' or 'yourself' to not send a copy.EOF my $entry = _prompt($description, "Local perl administrator", $cc);
if ($entry ne "") { $cc = $entry; $cc = '' if $me eq $cc; } }
$cc = '' if $cc =~ /^(none|yourself|me|myself|ourselves)$/i; if ($cc) { $andcc = " and $cc" } else { $andcc = '' }
# Prompt for editor, if no override is giveneditor: unless ($opt{e} || $opt{f} || $opt{b}) {
my $description;
chomp (my $common_end = <<"EOF");You will probably want to use a text editor to enter the body ofyour report. If "$ed" is the editor you want to use, then just pressEnter, otherwise type in the name of the editor you would like touse.
If you have already composed the body of your report, you may enter"file", and $0 will prompt you to enter the name of the filecontaining your report.EOF
if ($thanks) { $description = <<"EOF";It's now time to compose your thank-you message.
Some information about your local perl configuration will automaticallybe included at the end of your message, because we're curious aboutthe different ways that people build and use perl. If you'd rathernot share this information, you're welcome to delete it.
$common_endEOF } else { $description = <<"EOF";It's now time to compose your bug report. Try to make the reportconcise but descriptive. Please include any detail which you thinkmight be relevant or might help the volunteers working to improveperl. If you are reporting something that does not work as you thinkit should, please try to include examples of the actual result and ofwhat you expected.
Some information about your local perl configuration will automaticallybe included at the end of your report. If you are using an unusualversion of perl, it would be useful if you could confirm that youcan replicate the problem on a standard build of perl as well.
$common_endEOF }
my $entry = _prompt($description, "Editor", $ed); $usefile = 0; if ($entry eq "file") { $usefile = 1; } elsif ($entry ne "") { $ed = $entry; } } if ($::HaveCoreList && !$ok && !$thanks) { my $description = <<EOF;If your bug is about a Perl module rather than a core languagefeature, please enter its name here. If it's not, just hit Enterto skip this question.EOF
my $entry = ''; while ($entry eq '') { $entry = _prompt($description, 'Module'); my $first_release = Module::CoreList->first_release($entry); if ($entry and not $first_release) { paraprint <<EOF;$entry is not a "core" Perl module. Please check that you enteredits name correctly. If it is correct, quit this program, try searchingfor $entry on https://rt.cpan.org, and report your issue there.EOF
$entry = ''; } elsif (my $bug_tracker = $Module::CoreList::bug_tracker{$entry}) { paraprint <<"EOF";$entry included with core Perl is copied directly from the CPAN distribution.Please report bugs in $entry directly to its maintainers using $bug_trackerEOF $entry = ''; } elsif ($entry) { $category ||= 'library'; $report_about_module = $entry; last; } else { last; } } }
# Prompt for category of bug $category ||= ask_for_alternatives('category');
# Prompt for severity of bug $severity ||= ask_for_alternatives('severity');
# Generate scratch file to edit report in $filename = filename();
# Prompt for file to read report from, if needed if ($usefile and !$file) {filename: my $description = <<EOF;What is the name of the file that contains your report?EOF my $entry = _prompt($description, "Filename");
if ($entry eq "") { paraprint <<EOF;It seems you didn't enter a filename. Please choose to use a texteditor or enter a filename.EOF goto editor; }
unless (-f $entry and -r $entry) { paraprint <<EOF;'$entry' doesn't seem to be a readable file. You may have mistypedits name or may not have permission to read it.
If you don't want to use a file as the content of your report, justhit Enter and you'll be able to select a text editor instead.EOF goto filename; } $file = $entry; }
# Generate report open(REP, '>:raw', $filename) or die "Unable to create report file '$filename': $!\n"; binmode(REP, ':raw :crlf') if $Is_MSWin32;
my $reptype = !$ok ? ($thanks ? 'thank-you' : 'bug') : $opt{n} ? "build failure" : "success";
print REP <<EOF;This is a $reptype report for perl from $from,generated with the help of perlbug $VERSION running under perl $perl_version.
EOF
if ($body) { print REP $body; } elsif ($usefile) { open(F, '<:raw', $file) or die "Unable to read report file from '$file': $!\n"; binmode(F, ':raw :crlf') if $Is_MSWin32; while (<F>) { print REP $_ } close(F) or die "Error closing '$file': $!"; } else { if ($thanks) { print REP <<'EOF';
-----------------------------------------------------------------[Please enter your thank-you message here]
[You're welcome to delete anything below this line]-----------------------------------------------------------------EOF } else { print REP <<'EOF';
-----------------------------------------------------------------[Please describe your issue here]
[Please do not change anything below this line]-----------------------------------------------------------------EOF } } Dump(*REP); close(REP) or die "Error closing report file: $!";
# Set up an initial report fingerprint so we can compare it later _fingerprint_lines_in_report();
} # sub Query
sub Dump { local(*OUT) = @_;
# these won't have been set if run with -d $category ||= 'core'; $severity ||= 'low';
print OUT <<EFF;---Flags: category=$category severity=$severityEFF
if ($has_patch) { print OUT <<EFF; Type=Patch PatchStatus=HasPatchEFF }
if ($report_about_module ) { print OUT <<EFF; module=$report_about_moduleEFF } print OUT <<EFF;---EFF print OUT "This perlbug was built using Perl $config_tag1\n", "It is being executed now by Perl $config_tag2.\n\n" if $config_tag2 ne $config_tag1;
print OUT <<EOF;Site configuration information for perl $perl_version:
EOF if ($::Config{cf_by} and $::Config{cf_time}) { print OUT "Configured by $::Config{cf_by} at $::Config{cf_time}.\n\n"; } print OUT Config::myconfig;
if (@patches) { print OUT join "\n ", "Locally applied patches:", @patches; print OUT "\n"; };
print OUT <<EOF;
---\@INC for perl $perl_version:EOF for my $i (@INC) { print OUT " $i\n"; }
print OUT <<EOF;
---Environment for perl $perl_version:EOF my @env = qw(PATH LD_LIBRARY_PATH LANG PERL_BADLANG SHELL HOME LOGDIR LANGUAGE); push @env, $Config{ldlibpthname} if $Config{ldlibpthname} ne ''; push @env, grep /^(?:PERL|LC_|LANG|CYGWIN)/, keys %ENV; my %env; @env{@env} = @env; for my $env (sort keys %env) { print OUT " $env", exists $ENV{$env} ? "=$ENV{$env}" : ' (unset)', "\n"; } if ($verbose) { print OUT "\nComplete configuration data for perl $perl_version:\n\n"; my $value; foreach (sort keys %::Config) { $value = $::Config{$_}; $value = '' unless defined $value; $value =~ s/'/\\'/g; print OUT "$_='$value'\n"; } }} # sub Dump
sub Edit { # Edit the report if ($usefile || $body) { my $description = "Please make sure that the name of the editor you want to use is correct."; my $entry = _prompt($description, 'Editor', $ed); $ed = $entry unless $entry eq ''; }
_edit_file($ed) unless $running_noninteractively;}
sub _edit_file { my $editor = shift;
my $report_written = 0;
while ( !$report_written ) { my $exit_status = system("$editor $filename"); if ($exit_status) { my $desc = <<EOF;The editor you chose ('$editor') could not be run!
If you mistyped its name, please enter it now, otherwise just press Enter.EOF my $entry = _prompt( $desc, 'Editor', $editor ); if ( $entry ne "" ) { $editor = $entry; next; } else { paraprint <<EOF;You can edit your report after saving it to a file.EOF return; } } return if ( $ok and not $opt{n} ) || $body;
# Check that we have a report that has some, eh, report in it.
unless ( _fingerprint_lines_in_report() ) { my $description = <<EOF;It looks like you didn't enter a report. You may [r]etry your editor [c]ancel this report.EOF my $action = _prompt( $description, "Action (Retry/Cancel) " ); if ( $action =~ /^[re]/i ) { # <R>etry <E>dit next; } elsif ( $action =~ /^[cq]/i ) { # <C>ancel, <Q>uit Cancel(); # cancel exits } } # Ok. the user did what they needed to; return;
}}
sub Cancel { 1 while unlink($filename); # remove all versions under VMS print "\nQuitting without generating a report.\n"; exit(0);}
sub NowWhat { # Report is done, prompt for further action if( !$opt{S} ) { while(1) { my $send_to = $address || 'the Perl developers'; my $menu = <<EOF;
You have finished composing your report. At this point, you have a few options. You can:
* Save the report to a [f]ile * [Se]nd the report to $send_to$andcc * [D]isplay the report on the screen * [R]e-edit the report * Display or change the report's [su]bject * [Q]uit without generating the report
EOF retry: print $menu; my $action = _prompt('', "Action (Save/Send/Display/Edit/Subject/Quit)", $opt{t} ? 'q' : ''); print "\n"; if ($action =~ /^(f|sa)/i) { # <F>ile/<Sa>ve if ( SaveMessage() ) { exit } } elsif ($action =~ /^(d|l|sh)/i ) { # <D>isplay, <L>ist, <Sh>ow # Display the message print _read_report($filename); if ($have_attachment) { print "\n\n---\nAttachment(s):\n"; for my $att (split /\s*,\s*/, $attachments) { print " $att\n"; } } } elsif ($action =~ /^su/i) { # <Su>bject my $reply = _prompt( "Subject: $subject", "If the above subject is fine, press Enter. Otherwise, type a replacement now\nSubject"); if ($reply ne '') { unless (TrivialSubject($reply)) { $subject = $reply; print "Subject: $subject\n"; } } } elsif ($action =~ /^se/i) { # <S>end # Send the message if (not $thanks) { print <<EOFTo ensure your issue can be best tracked and resolved,you should submit it to the GitHub issue tracker athttps://github.com/Perl/perl5/issuesEOF } my $reply = _prompt( "Are you certain you want to send this report to $send_to$andcc?", 'Please type "yes" if you are','no'); if ($reply =~ /^yes$/) { $address ||= 'perl5-porters@perl.org'; last; } else { paraprint <<EOF;You didn't type "yes", so your report has not been sent.EOF } } elsif ($action =~ /^[er]/i) { # <E>dit, <R>e-edit # edit the message Edit(); } elsif ($action =~ /^[qc]/i) { # <C>ancel, <Q>uit Cancel(); } elsif ($action =~ /^s/i) { paraprint <<EOF;The command you entered was ambiguous. Please type "send", "save" or "subject".EOF } } }} # sub NowWhat
sub TrivialSubject { my $subject = shift; if ($subject =~ /^(y(es)?|no?|help|perl( (bug|problem))?|bug|problem)$/i || length($subject) < 4 || ($subject !~ /\s/ && ! $opt{t})) { # non-whitespace is accepted in test mode print "\nThe subject you entered wasn't very descriptive. Please try again.\n\n"; return 1; } else { return 0; }}
sub SaveMessage { my $file = _prompt( '', "Name of file to save report in", $outfile ); save_message_to_disk($file) || return undef; return 1;}
sub Send {
# Message has been accepted for transmission -- Send the message
# on linux certain "mail" implementations won't accept the subject # as "~s subject" and thus the Subject header will be corrupted # so don't use Mail::Send to be safe eval { if ( $::HaveSend && !$Is_Linux && !$Is_OpenBSD ) { _send_message_mailsend(); } elsif ($Is_VMS) { _send_message_vms(); } else { _send_message_sendmail(); } };
if ( my $error = $@ ) { paraprint <<EOF;$0 has detected an error while trying to send your message: $error.
Your message may not have been sent. You will now have a chance to save a copy to disk.EOF SaveMessage(); return; }
1 while unlink($filename); # remove all versions under VMS} # sub Send
sub Help { print <<EOF;
This program is designed to help you generate bug reports(and thank-you notes) about perl5 and the modules which ship with it.
In most cases, you can just run "$0" interactively from a commandline without any special arguments and follow the prompts.
Advanced usage:
$0 [-v] [-a address] [-s subject] [-b body | -f inpufile ] [ -F outputfile ] [-r returnaddress] [-e editor] [-c adminaddress | -C] [-S] [-t] [-h] [-p patchfile ]$0 [-v] [-r returnaddress] [-ok | -okay | -nok | -nokay]
Options:
-v Include Verbose configuration data in the report -f File containing the body of the report. Use this to quickly send a prepared report. -p File containing a patch or other text attachment. Separate multiple files with commas. -F File to output the resulting report to. Defaults to '$outfile'. -S Save or send the report without asking for confirmation. -a Send the report to this address, instead of saving to a file. -c Address to send copy of report to. Defaults to '$cc'. -C Don't send copy to administrator. -s Subject to include with the report. You will be prompted if you don't supply one on the command line. -b Body of the report. If not included on the command line, or in a file with -f, you will get a chance to edit the report. -r Your return address. The program will ask you to confirm this if you don't give it here. -e Editor to use. -t Test mode. -T Thank-you mode. The target address defaults to '$thanksaddress'. -d Data mode. This prints out your configuration data, without mailing anything. You can use this with -v to get more complete data. -ok Report successful build on this system to perl porters (use alone or with -v). Only use -ok if *everything* was ok: if there were *any* problems at all, use -nok. -okay As -ok but allow report from old builds. -nok Report unsuccessful build on this system to perl porters (use alone or with -v). You must describe what went wrong in the body of the report which you will be asked to edit. -nokay As -nok but allow report from old builds. -h Print this help message.
EOF}
sub filename { if ($::HaveTemp) { # Good. Use a secure temp file my ($fh, $filename) = File::Temp::tempfile(UNLINK => 1); close($fh); return $filename; } else { # Bah. Fall back to doing things less securely. my $dir = File::Spec->tmpdir(); $filename = "bugrep0$$"; $filename++ while -e File::Spec->catfile($dir, $filename); $filename = File::Spec->catfile($dir, $filename); }}
sub paraprint { my @paragraphs = split /\n{2,}/, "@_"; for (@paragraphs) { # implicit local $_ s/(\S)\s*\n/$1 /g; write; print "\n"; }}
sub _prompt { my ($explanation, $prompt, $default) = (@_); if ($explanation) { print "\n\n"; paraprint $explanation; } print $prompt. ($default ? " [$default]" :''). ": "; my $result = scalar(<>); return $default if !defined $result; # got eof chomp($result); $result =~ s/^\s*(.*?)\s*$/$1/s; if ($default && $result eq '') { return $default; } else { return $result; }}
sub _build_header { my %attr = (@_);
my $head = ''; for my $header (keys %attr) { $head .= "$header: ".$attr{$header}."\n"; } return $head;}
sub _message_headers { my %headers = ( To => $address || 'perl5-porters@perl.org', Subject => $subject ); $headers{'Cc'} = $cc if ($cc); $headers{'Message-Id'} = $messageid if ($messageid); $headers{'Reply-To'} = $from if ($from); $headers{'From'} = $from if ($from); if ($have_attachment) { $headers{'MIME-Version'} = '1.0'; $headers{'Content-Type'} = qq{multipart/mixed; boundary=\"$mime_boundary\"}; } return \%headers;}
sub _add_body_start { my $body_start = <<"BODY_START";This is a multi-part message in MIME format.--$mime_boundaryContent-Type: text/plain; format=fixedContent-Transfer-Encoding: 8bit
BODY_START return $body_start;}
sub _add_attachments { my $attach = ''; for my $attachment (split /\s*,\s*/, $attachments) { my $attach_file = basename($attachment); $attach .= <<"ATTACHMENT";
--$mime_boundaryContent-Type: text/x-patch; name="$attach_file"Content-Transfer-Encoding: 8bitContent-Disposition: attachment; filename="$attach_file"
ATTACHMENT
open my $attach_fh, '<:raw', $attachment or die "Couldn't open attachment '$attachment': $!\n"; while (<$attach_fh>) { $attach .= $_; } close($attach_fh) or die "Error closing attachment '$attachment': $!"; }
$attach .= "\n--$mime_boundary--\n"; return $attach;}
sub _read_report { my $fname = shift; my $content; open( REP, "<:raw", $fname ) or die "Couldn't open file '$fname': $!\n"; binmode(REP, ':raw :crlf') if $Is_MSWin32; # wrap long lines to make sure the report gets delivered local $Text::Wrap::columns = 900; local $Text::Wrap::huge = 'overflow'; while (<REP>) { if ($::HaveWrap && /\S/) { # wrap() would remove empty lines $content .= Text::Wrap::wrap(undef, undef, $_); } else { $content .= $_; } } close(REP) or die "Error closing report file '$fname': $!"; return $content;}
sub build_complete_message { my $content = _build_header(%{_message_headers()}) . "\n\n"; $content .= _add_body_start() if $have_attachment; $content .= _read_report($filename); $content .= _add_attachments() if $have_attachment; return $content;}
sub save_message_to_disk { my $file = shift;
if (-e $file) { my $response = _prompt( '', "Overwrite existing '$file'", 'n' ); return undef unless $response =~ / yes | y /xi; } open OUTFILE, '>:raw', $file or do { warn "Couldn't open '$file': $!\n"; return undef}; binmode(OUTFILE, ':raw :crlf') if $Is_MSWin32;
print OUTFILE build_complete_message(); close(OUTFILE) or do { warn "Error closing $file: $!"; return undef }; print "\nReport saved to '$file'. Please submit it to https://github.com/Perl/perl5/issues\n"; return 1;}
sub _send_message_vms {
my $mail_from = $from; my $rcpt_to_to = $address; my $rcpt_to_cc = $cc;
map { $_ =~ s/^[^<]*<//; $_ =~ s/>[^>]*//; } ($mail_from, $rcpt_to_to, $rcpt_to_cc);
if ( open my $sff_fh, '|-:raw', 'MCR TCPIP$SYSTEM:TCPIP$SMTP_SFF.EXE SYS$INPUT:' ) { print $sff_fh "MAIL FROM:<$mail_from>\n"; print $sff_fh "RCPT TO:<$rcpt_to_to>\n"; print $sff_fh "RCPT TO:<$rcpt_to_cc>\n" if $rcpt_to_cc; print $sff_fh "DATA\n"; print $sff_fh build_complete_message(); my $success = close $sff_fh; if ($success ) { print "\nMessage sent\n"; return; } } die "Mail transport failed (leaving bug report in $filename): $^E\n";}
sub _send_message_mailsend { my $msg = Mail::Send->new(); my %headers = %{_message_headers()}; for my $key ( keys %headers) { $msg->add($key => $headers{$key}); }
$fh = $msg->open; binmode($fh, ':raw'); print $fh _add_body_start() if $have_attachment; print $fh _read_report($filename); print $fh _add_attachments() if $have_attachment; $fh->close or die "Error sending mail: $!";
print "\nMessage sent.\n";}
sub _probe_for_sendmail { my $sendmail = ""; for (qw(/usr/lib/sendmail /usr/sbin/sendmail /usr/ucblib/sendmail)) { $sendmail = $_, last if -e $_; } if ( $^O eq 'os2' and $sendmail eq "" ) { my $path = $ENV{PATH}; $path =~ s:\\:/:; my @path = split /$Config{'path_sep'}/, $path; for (@path) { $sendmail = "$_/sendmail", last if -e "$_/sendmail"; $sendmail = "$_/sendmail.exe", last if -e "$_/sendmail.exe"; } } return $sendmail;}
sub _send_message_sendmail { my $sendmail = _probe_for_sendmail(); unless ($sendmail) { my $message_start = !$Is_Linux && !$Is_OpenBSD ? <<'EOT' : <<'EOT';It appears that there is no program which looks like "sendmail" onyour system and that the Mail::Send library from CPAN isn't available.EOTIt appears that there is no program which looks like "sendmail" onyour system.EOT paraprint(<<"EOF"), die "\n";$message_startBecause of this, there's no easy way to automatically send yourreport.
A copy of your report has been saved in '$filename' for you tosend to '$address' with your normal mail client.EOF }
open( SENDMAIL, "|-:raw", $sendmail, "-t", "-oi", "-f", $from ) || die "'|$sendmail -t -oi -f $from' failed: $!"; print SENDMAIL build_complete_message(); if ( close(SENDMAIL) ) { print "\nMessage sent\n"; } else { warn "\nSendmail returned status '", $? >> 8, "'\n"; }}
# a strange way to check whether any significant editing# has been done: check whether any new non-empty lines# have been added.
sub _fingerprint_lines_in_report { my $new_lines = 0; # read in the report template once so that # we can track whether the user does any editing. # yes, *all* whitespace is ignored.
open(REP, '<:raw', $filename) or die "Unable to open report file '$filename': $!\n"; binmode(REP, ':raw :crlf') if $Is_MSWin32; while (my $line = <REP>) { $line =~ s/\s+//g; $new_lines++ if (!$REP{$line});
} close(REP) or die "Error closing report file '$filename': $!"; # returns the number of lines with content that wasn't there when last we looked return $new_lines;}
format STDOUT =^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~$_.
__END__
=head1 NAME
perlbug - how to submit bug reports on Perl
=head1 SYNOPSIS
B<perlbug>
B<perlbug> S<[ B<-v> ]> S<[ B<-a> I<address> ]> S<[ B<-s> I<subject> ]>S<[ B<-b> I<body> | B<-f> I<inputfile> ]> S<[ B<-F> I<outputfile> ]>S<[ B<-r> I<returnaddress> ]>S<[ B<-e> I<editor> ]> S<[ B<-c> I<adminaddress> | B<-C> ]>S<[ B<-S> ]> S<[ B<-t> ]> S<[ B<-d> ]> S<[ B<-h> ]> S<[ B<-T> ]>
B<perlbug> S<[ B<-v> ]> S<[ B<-r> I<returnaddress> ]> S<[ B<-ok> | B<-okay> | B<-nok> | B<-nokay> ]>
B<perlthanks>
=head1 DESCRIPTION
This program is designed to help you generate bug reports(and thank-you notes) about perl5 and the modules which ship with it.
In most cases, you can just run it interactively from a commandline without any special arguments and follow the prompts.
If you have found a bug with a non-standard port (one that was notpart of the I<standard distribution>), a binary distribution, or anon-core module (such as Tk, DBI, etc), then please see thedocumentation that came with that distribution to determine thecorrect place to report bugs.
Bug reports should be submitted to the GitHub issue tracker atL<https://github.com/Perl/perl5/issues>. The B<perlbug@perl.org>address no longer automatically opens tickets. You can use this toolto compose your report and save it to a file which you can then submitto the issue tracker.
In extreme cases, B<perlbug> may not work well enough on your systemto guide you through composing a bug report. In those cases, youmay be able to use B<perlbug -d> or B<perl -V> to get systemconfiguration information to include in your issue report.
When reporting a bug, please run through this checklist:
=over 4
=item What version of Perl you are running?
Type C<perl -v> at the command line to find out.
=item Are you running the latest released version of perl?
Look at L<http://www.perl.org/> to find out. If you are not using thelatest released version, please try to replicate your bug on thelatest stable release.
Note that reports about bugs in old versions of Perl, especiallythose which indicate you haven't also tested the current stablerelease of Perl, are likely to receive less attention from thevolunteers who build and maintain Perl than reports about bugs inthe current release.
This tool isn't appropriate for reporting bugs in any versionprior to Perl 5.0.
=item Are you sure what you have is a bug?
A significant number of the bug reports we get turn out to bedocumented features in Perl. Make sure the issue you've run intoisn't intentional by glancing through the documentation that comeswith the Perl distribution.
Given the sheer volume of Perl documentation, this isn't a trivialundertaking, but if you can point to documentation that suggeststhe behaviour you're seeing is I<wrong>, your issue is likely toreceive more attention. You may want to start with B<perldoc>L<perltrap> for pointers to common traps that new (and experienced)Perl programmers run into.
If you're unsure of the meaning of an error message you've runacross, B<perldoc> L<perldiag> for an explanation. If the messageisn't in perldiag, it probably isn't generated by Perl. You mayhave luck consulting your operating system documentation instead.
If you are on a non-UNIX platform B<perldoc> L<perlport>, as somefeatures may be unimplemented or work differently.
You may be able to figure out what's going wrong using the Perldebugger. For information about how to use the debugger B<perldoc>L<perldebug>.
=item Do you have a proper test case?
The easier it is to reproduce your bug, the more likely it will befixed -- if nobody can duplicate your problem, it probably won't be addressed.
A good test case has most of these attributes: short, simple code;few dependencies on external commands, modules, or libraries; noplatform-dependent code (unless it's a platform-specific bug);clear, simple documentation.
A good test case is almost always a good candidate to be included inPerl's test suite. If you have the time, consider writing your test case sothat it can be easily included into the standard test suite.
=item Have you included all relevant information?
Be sure to include the B<exact> error messages, if any."Perl gave an error" is not an exact error message.
If you get a core dump (or equivalent), you may use a debugger(B<dbx>, B<gdb>, etc) to produce a stack trace to include in the bugreport.
NOTE: unless your Perl has been compiled with debug info(often B<-g>), the stack trace is likely to be somewhat hard to usebecause it will most probably contain only the function names and nottheir arguments. If possible, recompile your Perl with debug info andreproduce the crash and the stack trace.
=item Can you describe the bug in plain English?
The easier it is to understand a reproducible bug, the more likelyit will be fixed. Any insight you can provide into the problemwill help a great deal. In other words, try to analyze the problem(to the extent you can) and report your discoveries.
=item Can you fix the bug yourself?
If so, that's great news; bug reports with patches are likely toreceive significantly more attention and interest than those withoutpatches. Please submit your patch via the GitHub Pull Request workflowas described in B<perldoc> L<perlhack>. You may also send patches toB<perl5-porters@perl.org>. When sending a patch, create it usingC<git format-patch> if possible, though a unified diff created withC<diff -pu> will do nearly as well.
Your patch may be returned with requests for changes, or requests for moredetailed explanations about your fix.
Here are a few hints for creating high-quality patches:
Make sure the patch is not reversed (the first argument to diff istypically the original file, the second argument your changed file).Make sure you test your patch by applying it with C<git am> or theC<patch> program before you send it on its way. Try to follow thesame style as the code you are trying to patch. Make sure your patchreally does work (C<make test>, if the thing you're patching is coveredby Perl's test suite).
=item Can you use C<perlbug> to submit a thank-you note?
Yes, you can do this by either using the C<-T> option, or by invokingthe program as C<perlthanks>. Thank-you notes are good. It makes peoplesmile.
=back
Please make your issue title informative. "a bug" is not informative.Neither is "perl crashes" nor is "HELP!!!". These don't help. A compactdescription of what's wrong is fine.
Having done your bit, please be prepared to wait, to be told thebug is in your code, or possibly to get no reply at all. Thevolunteers who maintain Perl are busy folks, so if your problem isan obvious bug in your own code, is difficult to understand or isa duplicate of an existing report, you may not receive a personalreply.
If it is important to you that your bug be fixed, do monitor theissue tracker (you will be subscribed to notifications for issues yousubmit or comment on) and the commit logs to developmentversions of Perl, and encourage the maintainers with kind words oroffers of frosty beverages. (Please do be kind to the maintainers.Harassing or flaming them is likely to have the opposite effect of theone you want.)
Feel free to update the ticket about your bug onL<https://github.com/Perl/perl5/issues>if a new version of Perl is released and your bug is still present.
=head1 OPTIONS
=over 8
=item B<-a>
Address to send the report to instead of saving to a file.
=item B<-b>
Body of the report. If not included on the command line, orin a file with B<-f>, you will get a chance to edit the report.
=item B<-C>
Don't send copy to administrator when sending report by mail.
=item B<-c>
Address to send copy of report to when sending report by mail.Defaults to the address of thelocal perl administrator (recorded when perl was built).
=item B<-d>
Data mode (the default if you redirect or pipe output). This prints outyour configuration data, without saving or mailing anything. You can usethis with B<-v> to get more complete data.
=item B<-e>
Editor to use.
=item B<-f>
File containing the body of the report. Use this to quickly send aprepared report.
=item B<-F>
File to output the results to. Defaults to B<perlbug.rep>.
=item B<-h>
Prints a brief summary of the options.
=item B<-ok>
Report successful build on this system to perl porters. Forces B<-S>and B<-C>. Forces and supplies values for B<-s> and B<-b>. Onlyprompts for a return address if it cannot guess it (for use withB<make>). Honors return address specified with B<-r>. You can use thiswith B<-v> to get more complete data. Only makes a report if thissystem is less than 60 days old.
=item B<-okay>
As B<-ok> except it will report on older systems.
=item B<-nok>
Report unsuccessful build on this system. Forces B<-C>. Forces andsupplies a value for B<-s>, then requires you to edit the reportand say what went wrong. Alternatively, a prepared report may besupplied using B<-f>. Only prompts for a return address if itcannot guess it (for use with B<make>). Honors return addressspecified with B<-r>. You can use this with B<-v> to get morecomplete data. Only makes a report if this system is less than 60days old.
=item B<-nokay>
As B<-nok> except it will report on older systems.
=item B<-p>
The names of one or more patch files or other text attachments to beincluded with the report. Multiple files must be separated with commas.
=item B<-r>
Your return address. The program will ask you to confirm its defaultif you don't use this option.
=item B<-S>
Save or send the report without asking for confirmation.
=item B<-s>
Subject to include with the report. You will be prompted if you don'tsupply one on the command line.
=item B<-t>
Test mode. Makes it possible to command perlbug from a pipe or file, fortesting purposes.
=item B<-T>
Send a thank-you note instead of a bug report.
=item B<-v>
Include verbose configuration data in the report.
=back
=head1 AUTHORS
Kenneth Albanowski (E<lt>kjahds@kjahds.comE<gt>), subsequentlyI<doc>tored by Gurusamy Sarathy (E<lt>gsar@activestate.comE<gt>),Tom Christiansen (E<lt>tchrist@perl.comE<gt>), Nathan Torkington(E<lt>gnat@frii.comE<gt>), Charles F. Randall (E<lt>cfr@pobox.comE<gt>),Mike Guy (E<lt>mjtg@cam.ac.ukE<gt>), Dominic Dunlop(E<lt>domo@computer.orgE<gt>), Hugo van der Sanden (E<lt>hv@crypt.orgE<gt>),Jarkko Hietaniemi (E<lt>jhi@iki.fiE<gt>), Chris Nandor(E<lt>pudge@pobox.comE<gt>), Jon Orwant (E<lt>orwant@media.mit.eduE<gt>,Richard Foley (E<lt>richard.foley@rfi.netE<gt>), Jesse Vincent(E<lt>jesse@bestpractical.comE<gt>), and Craig A. Berry (E<lt>craigberry@mac.comE<gt>).
=head1 SEE ALSO
perl(1), perldebug(1), perldiag(1), perlport(1), perltrap(1),diff(1), patch(1), dbx(1), gdb(1)
=head1 BUGS
None known (guess what must have been used to report them?)
=cut
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518#!/home/zangyihe/miniconda3/bin/perl eval 'exec /home/zangyihe/miniconda3/bin/perl -S $0 ${1+"$@"}' if $running_under_some_shell;
my $config_tag1 = '5.32.1 - Sat Dec 23 05:44:15 UTC 2023';
my $patchlevel_date = 1610211291;my @patches = Config::local_patches();my $patch_tags = join "", map /(\S+)/ ? "+$1 " : (), @patches;
BEGIN { pop @INC if $INC[-1] eq '.' }use warnings;use strict;use Config;use File::Spec; # keep perlbug Perl 5.005 compatibleuse Getopt::Std;use File::Basename 'basename';
$Getopt::Std::STANDARD_HELP_VERSION = 1;
sub paraprint;
BEGIN { eval { require Mail::Send;}; $::HaveSend = ($@ eq ""); eval { require Mail::Util; } ; $::HaveUtil = ($@ eq ""); # use secure tempfiles wherever possible eval { require File::Temp; }; $::HaveTemp = ($@ eq ""); eval { require Module::CoreList; }; $::HaveCoreList = ($@ eq ""); eval { require Text::Wrap; }; $::HaveWrap = ($@ eq "");};
our $VERSION = "1.42";
#TODO:# make sure failure (transmission-wise) of Mail::Send is accounted for.# (This may work now. Unsure of the original author's issue -JESSE 2008-06-08)# - Test -b option
my( $file, $usefile, $cc, $address, $thanksaddress, $filename, $messageid, $domain, $subject, $from, $verbose, $ed, $outfile, $fh, $me, $body, $andcc, %REP, $ok, $thanks, $progname, $Is_MSWin32, $Is_Linux, $Is_VMS, $Is_OpenBSD, $report_about_module, $category, $severity, %opt, $have_attachment, $attachments, $has_patch, $mime_boundary);
my $running_noninteractively = !-t STDIN;
my $perl_version = $^V ? sprintf("%vd", $^V) : $];
my $config_tag2 = "$perl_version - $Config{cf_time}";
Init();
if ($opt{h}) { Help(); exit; }if ($opt{d}) { Dump(*STDOUT); exit; }if ($running_noninteractively && !$opt{t} && !($ok and not $opt{n})) { paraprint <<"EOF";Please use $progname interactively. If you want toinclude a file, you can use the -f switch.EOF die "\n";}
Query();Edit() unless $usefile || ($ok and not $opt{n});NowWhat();if ($address) { Send(); if ($thanks) { print "\nThank you for taking the time to send a thank-you message!\n\n";
paraprint <<EOFPlease note that mailing lists are moderated, your message may take a while toshow up.EOF } else { print "\nThank you for taking the time to file a bug report!\n\n";
paraprint <<EOFPlease note that mailing lists are moderated, your message may take a while toshow up. Please consider submitting your report directly to the issue trackerat https://github.com/Perl/perl5/issuesEOF }
} else { save_message_to_disk($outfile);}
exit;
sub ask_for_alternatives { # (category|severity) my $name = shift; my %alts = ( 'category' => { 'default' => 'core', 'ok' => 'install', # Inevitably some of these will end up in RT whatever we do: 'thanks' => 'thanks', 'opts' => [qw(core docs install library utilities)], # patch, notabug }, 'severity' => { 'default' => 'low', 'ok' => 'none', 'thanks' => 'none', 'opts' => [qw(critical high medium low wishlist none)], # zero }, ); die "Invalid alternative ($name) requested\n" unless grep(/^$name$/, keys %alts); my $alt = ""; my $what = $ok || $thanks; if ($what) { $alt = $alts{$name}{$what}; } else { my @alts = @{$alts{$name}{'opts'}}; print "\n\n"; paraprint <<EOF;Please pick a $name from the following list:
@altsEOF my $err = 0; do { if ($err++ > 5) { die "Invalid $name: aborting.\n"; } $alt = _prompt('', "\u$name", $alts{$name}{'default'}); $alt ||= $alts{$name}{'default'}; } while !((($alt) = grep(/^$alt/i, @alts))); } lc $alt;}
sub HELP_MESSAGE { Help(); exit; }sub VERSION_MESSAGE { print "perlbug version $VERSION\n"; }
sub Init { # -------- Setup --------
$Is_MSWin32 = $^O eq 'MSWin32'; $Is_VMS = $^O eq 'VMS'; $Is_Linux = lc($^O) eq 'linux'; $Is_OpenBSD = lc($^O) eq 'openbsd';
# Thanks address $thanksaddress = 'perl-thanks@perl.org';
# Defaults if getopts fails. $outfile = (basename($0) =~ /^perlthanks/i) ? "perlthanks.rep" : "perlbug.rep"; $cc = $::Config{'perladmin'} || $::Config{'cf_email'} || $::Config{'cf_by'} || '';
HELP_MESSAGE() unless getopts("Adhva:s:b:f:F:r:e:SCc:to:n:T:p:", \%opt);
# This comment is needed to notify metaconfig that we are # using the $perladmin, $cf_by, and $cf_time definitions. # -------- Configuration ---------
if (basename ($0) =~ /^perlthanks/i) { # invoked as perlthanks $opt{T} = 1; $opt{C} = 1; # don't send a copy to the local admin }
if ($opt{T}) { $thanks = 'thanks'; } $progname = $thanks ? 'perlthanks' : 'perlbug'; # Target address $address = $opt{a} || ($thanks ? $thanksaddress : "");
# Users address, used in message and in From and Reply-To headers $from = $opt{r} || "";
# Include verbose configuration information $verbose = $opt{v} || 0;
# Subject of bug-report message $subject = $opt{s} || "";
# Send a file $usefile = ($opt{f} || 0);
# File to send as report $file = $opt{f} || "";
# We have one or more attachments $have_attachment = ($opt{p} || 0); $mime_boundary = ('-' x 12) . "$VERSION.perlbug" if $have_attachment;
# Comma-separated list of attachments $attachments = $opt{p} || ""; $has_patch = 0; # TBD based on file type
for my $attachment (split /\s*,\s*/, $attachments) { unless (-f $attachment && -r $attachment) { die "The attachment $attachment is not a readable file: $!\n"; } $has_patch = 1 if $attachment =~ m/\.(patch|diff)$/; }
# File to output to $outfile = $opt{F} || "$progname.rep";
# Body of report $body = $opt{b} || ""; # Editor $ed = $opt{e} || $ENV{VISUAL} || $ENV{EDITOR} || $ENV{EDIT} || ($Is_VMS && "edit/tpu") || ($Is_MSWin32 && "notepad") || "vi";
# Not OK - provide build failure template by finessing OK report if ($opt{n}) { if (substr($opt{n}, 0, 2) eq 'ok' ) { $opt{o} = substr($opt{n}, 1); } else { Help(); exit(); } }
# OK - send "OK" report for build on this system $ok = ''; if ($opt{o}) { if ($opt{o} eq 'k' or $opt{o} eq 'kay') { my $age = time - $patchlevel_date; if ($opt{o} eq 'k' and $age > 60 * 24 * 60 * 60 ) { my $date = localtime $patchlevel_date; print <<"EOF";"perlbug -ok" and "perlbug -nok" do not report on Perl versions whichare more than 60 days old. This Perl version was constructed on$date. If you really want to report this, use"perlbug -okay" or "perlbug -nokay".EOF exit(); } # force these options unless ($opt{n}) { $opt{S} = 1; # don't prompt for send $opt{b} = 1; # we have a body $body = "Perl reported to build OK on this system.\n"; } $opt{C} = 1; # don't send a copy to the local admin $opt{s} = 1; # we have a subject line $subject = ($opt{n} ? 'Not ' : '') . "OK: perl $perl_version ${patch_tags}on" ." $::Config{'archname'} $::Config{'osvers'} $subject"; $ok = 'ok'; } else { Help(); exit(); } }
# Possible administrator addresses, in order of confidence # (Note that cf_email is not mentioned to metaconfig, since # we don't really want it. We'll just take it if we have to.) # # This has to be after the $ok stuff above because of the way # that $opt{C} is forced. $cc = $opt{C} ? "" : ( $opt{c} || $::Config{'perladmin'} || $::Config{'cf_email'} || $::Config{'cf_by'} );
if ($::HaveUtil) { $domain = Mail::Util::maildomain(); } elsif ($Is_MSWin32) { $domain = $ENV{'USERDOMAIN'}; } else { require Sys::Hostname; $domain = Sys::Hostname::hostname(); }
# Message-Id - rjsf $messageid = "<$::Config{'version'}_${$}_".time."\@$domain>";
# My username $me = $Is_MSWin32 ? $ENV{'USERNAME'} : $^O eq 'os2' ? $ENV{'USER'} || $ENV{'LOGNAME'} : eval { getpwuid($<) }; # May be missing
$from = $::Config{'cf_email'} if !$from && $::Config{'cf_email'} && $::Config{'cf_by'} && $me && ($me eq $::Config{'cf_by'});} # sub Init
sub Query { # Explain what perlbug is unless ($ok) { if ($thanks) { paraprint <<'EOF';This program provides an easy way to send a thank-you message back to theauthors and maintainers of perl.
If you wish to generate a bug report, please run it without the -T flag(or run the program perlbug rather than perlthanks)EOF } else { paraprint <<"EOF";This program provides an easy way to generate a bug report for the coreperl distribution (along with tests or patches). To send a thank-younote to $thanksaddress instead of a bug report, please run 'perlthanks'.
The GitHub issue tracker at https://github.com/Perl/perl5/issues is thebest place to submit your report so it can be tracked and resolved.
Please do not use $0 to report bugs in perl modules from CPAN.
Suggestions for how to find help using Perl can be found athttps://perldoc.perl.org/perlcommunity.htmlEOF } }
# Prompt for subject of message, if needed if ($subject && TrivialSubject($subject)) { $subject = ''; }
unless ($subject) { print "First of all, please provide a subject for the report.\n"; if ( not $thanks) { paraprint <<EOF;This should be a concise description of your bug or problemwhich will help the volunteers working to improve perl to categorizeand resolve the issue. Be as specific and descriptive asyou can. A subject like "perl bug" or "perl problem" will make itmuch less likely that your issue gets the attention it deserves.EOF }
my $err = 0; do { $subject = _prompt('','Subject'); if ($err++ == 5) { if ($thanks) { $subject = 'Thanks for Perl'; } else { die "Aborting.\n"; } } } while (TrivialSubject($subject)); } $subject = '[PATCH] ' . $subject if $has_patch && ($subject !~ m/^\[PATCH/i);
# Prompt for return address, if needed unless ($opt{r}) { # Try and guess return address my $guess;
$guess = $ENV{'REPLY-TO'} || $ENV{'REPLYTO'} || $ENV{'EMAIL'} || $from || '';
unless ($guess) { # move $domain to where we can use it elsewhere if ($domain) { if ($Is_VMS && !$::Config{'d_socket'}) { $guess = "$domain\:\:$me"; } else { $guess = "$me\@$domain" if $domain; } } }
if ($guess) { unless ($ok) { paraprint <<EOF;Perl's developers may need your email address to contact you forfurther information about your issue or to inform you when it isresolved. If the default shown is not your email address, pleasecorrect it.EOF } } else { paraprint <<EOF;Please enter your full internet email address so that Perl'sdevelopers can contact you with questions about your issue or toinform you that it has been resolved.EOF }
if ($ok && $guess) { # use it $from = $guess; } else { # verify it $from = _prompt('','Your address',$guess); $from = $guess if $from eq ''; } }
if ($from eq $cc or $me eq $cc) { # Try not to copy ourselves $cc = "yourself"; }
# Prompt for administrator address, unless an override was given if( $address and !$opt{C} and !$opt{c} ) { my $description = <<EOF;$0 can send a copy of this report to your local perladministrator. If the address below is wrong, please correct it,or enter 'none' or 'yourself' to not send a copy.EOF my $entry = _prompt($description, "Local perl administrator", $cc);
if ($entry ne "") { $cc = $entry; $cc = '' if $me eq $cc; } }
$cc = '' if $cc =~ /^(none|yourself|me|myself|ourselves)$/i; if ($cc) { $andcc = " and $cc" } else { $andcc = '' }
# Prompt for editor, if no override is giveneditor: unless ($opt{e} || $opt{f} || $opt{b}) {
my $description;
chomp (my $common_end = <<"EOF");You will probably want to use a text editor to enter the body ofyour report. If "$ed" is the editor you want to use, then just pressEnter, otherwise type in the name of the editor you would like touse.
If you have already composed the body of your report, you may enter"file", and $0 will prompt you to enter the name of the filecontaining your report.EOF
if ($thanks) { $description = <<"EOF";It's now time to compose your thank-you message.
Some information about your local perl configuration will automaticallybe included at the end of your message, because we're curious aboutthe different ways that people build and use perl. If you'd rathernot share this information, you're welcome to delete it.
$common_endEOF } else { $description = <<"EOF";It's now time to compose your bug report. Try to make the reportconcise but descriptive. Please include any detail which you thinkmight be relevant or might help the volunteers working to improveperl. If you are reporting something that does not work as you thinkit should, please try to include examples of the actual result and ofwhat you expected.
Some information about your local perl configuration will automaticallybe included at the end of your report. If you are using an unusualversion of perl, it would be useful if you could confirm that youcan replicate the problem on a standard build of perl as well.
$common_endEOF }
my $entry = _prompt($description, "Editor", $ed); $usefile = 0; if ($entry eq "file") { $usefile = 1; } elsif ($entry ne "") { $ed = $entry; } } if ($::HaveCoreList && !$ok && !$thanks) { my $description = <<EOF;If your bug is about a Perl module rather than a core languagefeature, please enter its name here. If it's not, just hit Enterto skip this question.EOF
my $entry = ''; while ($entry eq '') { $entry = _prompt($description, 'Module'); my $first_release = Module::CoreList->first_release($entry); if ($entry and not $first_release) { paraprint <<EOF;$entry is not a "core" Perl module. Please check that you enteredits name correctly. If it is correct, quit this program, try searchingfor $entry on https://rt.cpan.org, and report your issue there.EOF
$entry = ''; } elsif (my $bug_tracker = $Module::CoreList::bug_tracker{$entry}) { paraprint <<"EOF";$entry included with core Perl is copied directly from the CPAN distribution.Please report bugs in $entry directly to its maintainers using $bug_trackerEOF $entry = ''; } elsif ($entry) { $category ||= 'library'; $report_about_module = $entry; last; } else { last; } } }
# Prompt for category of bug $category ||= ask_for_alternatives('category');
# Prompt for severity of bug $severity ||= ask_for_alternatives('severity');
# Generate scratch file to edit report in $filename = filename();
# Prompt for file to read report from, if needed if ($usefile and !$file) {filename: my $description = <<EOF;What is the name of the file that contains your report?EOF my $entry = _prompt($description, "Filename");
if ($entry eq "") { paraprint <<EOF;It seems you didn't enter a filename. Please choose to use a texteditor or enter a filename.EOF goto editor; }
unless (-f $entry and -r $entry) { paraprint <<EOF;'$entry' doesn't seem to be a readable file. You may have mistypedits name or may not have permission to read it.
If you don't want to use a file as the content of your report, justhit Enter and you'll be able to select a text editor instead.EOF goto filename; } $file = $entry; }
# Generate report open(REP, '>:raw', $filename) or die "Unable to create report file '$filename': $!\n"; binmode(REP, ':raw :crlf') if $Is_MSWin32;
my $reptype = !$ok ? ($thanks ? 'thank-you' : 'bug') : $opt{n} ? "build failure" : "success";
print REP <<EOF;This is a $reptype report for perl from $from,generated with the help of perlbug $VERSION running under perl $perl_version.
EOF
if ($body) { print REP $body; } elsif ($usefile) { open(F, '<:raw', $file) or die "Unable to read report file from '$file': $!\n"; binmode(F, ':raw :crlf') if $Is_MSWin32; while (<F>) { print REP $_ } close(F) or die "Error closing '$file': $!"; } else { if ($thanks) { print REP <<'EOF';
-----------------------------------------------------------------[Please enter your thank-you message here]
[You're welcome to delete anything below this line]-----------------------------------------------------------------EOF } else { print REP <<'EOF';
-----------------------------------------------------------------[Please describe your issue here]
[Please do not change anything below this line]-----------------------------------------------------------------EOF } } Dump(*REP); close(REP) or die "Error closing report file: $!";
# Set up an initial report fingerprint so we can compare it later _fingerprint_lines_in_report();
} # sub Query
sub Dump { local(*OUT) = @_;
# these won't have been set if run with -d $category ||= 'core'; $severity ||= 'low';
print OUT <<EFF;---Flags: category=$category severity=$severityEFF
if ($has_patch) { print OUT <<EFF; Type=Patch PatchStatus=HasPatchEFF }
if ($report_about_module ) { print OUT <<EFF; module=$report_about_moduleEFF } print OUT <<EFF;---EFF print OUT "This perlbug was built using Perl $config_tag1\n", "It is being executed now by Perl $config_tag2.\n\n" if $config_tag2 ne $config_tag1;
print OUT <<EOF;Site configuration information for perl $perl_version:
EOF if ($::Config{cf_by} and $::Config{cf_time}) { print OUT "Configured by $::Config{cf_by} at $::Config{cf_time}.\n\n"; } print OUT Config::myconfig;
if (@patches) { print OUT join "\n ", "Locally applied patches:", @patches; print OUT "\n"; };
print OUT <<EOF;
---\@INC for perl $perl_version:EOF for my $i (@INC) { print OUT " $i\n"; }
print OUT <<EOF;
---Environment for perl $perl_version:EOF my @env = qw(PATH LD_LIBRARY_PATH LANG PERL_BADLANG SHELL HOME LOGDIR LANGUAGE); push @env, $Config{ldlibpthname} if $Config{ldlibpthname} ne ''; push @env, grep /^(?:PERL|LC_|LANG|CYGWIN)/, keys %ENV; my %env; @env{@env} = @env; for my $env (sort keys %env) { print OUT " $env", exists $ENV{$env} ? "=$ENV{$env}" : ' (unset)', "\n"; } if ($verbose) { print OUT "\nComplete configuration data for perl $perl_version:\n\n"; my $value; foreach (sort keys %::Config) { $value = $::Config{$_}; $value = '' unless defined $value; $value =~ s/'/\\'/g; print OUT "$_='$value'\n"; } }} # sub Dump
sub Edit { # Edit the report if ($usefile || $body) { my $description = "Please make sure that the name of the editor you want to use is correct."; my $entry = _prompt($description, 'Editor', $ed); $ed = $entry unless $entry eq ''; }
_edit_file($ed) unless $running_noninteractively;}
sub _edit_file { my $editor = shift;
my $report_written = 0;
while ( !$report_written ) { my $exit_status = system("$editor $filename"); if ($exit_status) { my $desc = <<EOF;The editor you chose ('$editor') could not be run!
If you mistyped its name, please enter it now, otherwise just press Enter.EOF my $entry = _prompt( $desc, 'Editor', $editor ); if ( $entry ne "" ) { $editor = $entry; next; } else { paraprint <<EOF;You can edit your report after saving it to a file.EOF return; } } return if ( $ok and not $opt{n} ) || $body;
# Check that we have a report that has some, eh, report in it.
unless ( _fingerprint_lines_in_report() ) { my $description = <<EOF;It looks like you didn't enter a report. You may [r]etry your editor [c]ancel this report.EOF my $action = _prompt( $description, "Action (Retry/Cancel) " ); if ( $action =~ /^[re]/i ) { # <R>etry <E>dit next; } elsif ( $action =~ /^[cq]/i ) { # <C>ancel, <Q>uit Cancel(); # cancel exits } } # Ok. the user did what they needed to; return;
}}
sub Cancel { 1 while unlink($filename); # remove all versions under VMS print "\nQuitting without generating a report.\n"; exit(0);}
sub NowWhat { # Report is done, prompt for further action if( !$opt{S} ) { while(1) { my $send_to = $address || 'the Perl developers'; my $menu = <<EOF;
You have finished composing your report. At this point, you have a few options. You can:
* Save the report to a [f]ile * [Se]nd the report to $send_to$andcc * [D]isplay the report on the screen * [R]e-edit the report * Display or change the report's [su]bject * [Q]uit without generating the report
EOF retry: print $menu; my $action = _prompt('', "Action (Save/Send/Display/Edit/Subject/Quit)", $opt{t} ? 'q' : ''); print "\n"; if ($action =~ /^(f|sa)/i) { # <F>ile/<Sa>ve if ( SaveMessage() ) { exit } } elsif ($action =~ /^(d|l|sh)/i ) { # <D>isplay, <L>ist, <Sh>ow # Display the message print _read_report($filename); if ($have_attachment) { print "\n\n---\nAttachment(s):\n"; for my $att (split /\s*,\s*/, $attachments) { print " $att\n"; } } } elsif ($action =~ /^su/i) { # <Su>bject my $reply = _prompt( "Subject: $subject", "If the above subject is fine, press Enter. Otherwise, type a replacement now\nSubject"); if ($reply ne '') { unless (TrivialSubject($reply)) { $subject = $reply; print "Subject: $subject\n"; } } } elsif ($action =~ /^se/i) { # <S>end # Send the message if (not $thanks) { print <<EOFTo ensure your issue can be best tracked and resolved,you should submit it to the GitHub issue tracker athttps://github.com/Perl/perl5/issuesEOF } my $reply = _prompt( "Are you certain you want to send this report to $send_to$andcc?", 'Please type "yes" if you are','no'); if ($reply =~ /^yes$/) { $address ||= 'perl5-porters@perl.org'; last; } else { paraprint <<EOF;You didn't type "yes", so your report has not been sent.EOF } } elsif ($action =~ /^[er]/i) { # <E>dit, <R>e-edit # edit the message Edit(); } elsif ($action =~ /^[qc]/i) { # <C>ancel, <Q>uit Cancel(); } elsif ($action =~ /^s/i) { paraprint <<EOF;The command you entered was ambiguous. Please type "send", "save" or "subject".EOF } } }} # sub NowWhat
sub TrivialSubject { my $subject = shift; if ($subject =~ /^(y(es)?|no?|help|perl( (bug|problem))?|bug|problem)$/i || length($subject) < 4 || ($subject !~ /\s/ && ! $opt{t})) { # non-whitespace is accepted in test mode print "\nThe subject you entered wasn't very descriptive. Please try again.\n\n"; return 1; } else { return 0; }}
sub SaveMessage { my $file = _prompt( '', "Name of file to save report in", $outfile ); save_message_to_disk($file) || return undef; return 1;}
sub Send {
# Message has been accepted for transmission -- Send the message
# on linux certain "mail" implementations won't accept the subject # as "~s subject" and thus the Subject header will be corrupted # so don't use Mail::Send to be safe eval { if ( $::HaveSend && !$Is_Linux && !$Is_OpenBSD ) { _send_message_mailsend(); } elsif ($Is_VMS) { _send_message_vms(); } else { _send_message_sendmail(); } };
if ( my $error = $@ ) { paraprint <<EOF;$0 has detected an error while trying to send your message: $error.
Your message may not have been sent. You will now have a chance to save a copy to disk.EOF SaveMessage(); return; }
1 while unlink($filename); # remove all versions under VMS} # sub Send
sub Help { print <<EOF;
This program is designed to help you generate bug reports(and thank-you notes) about perl5 and the modules which ship with it.
In most cases, you can just run "$0" interactively from a commandline without any special arguments and follow the prompts.
Advanced usage:
$0 [-v] [-a address] [-s subject] [-b body | -f inpufile ] [ -F outputfile ] [-r returnaddress] [-e editor] [-c adminaddress | -C] [-S] [-t] [-h] [-p patchfile ]$0 [-v] [-r returnaddress] [-ok | -okay | -nok | -nokay]
Options:
-v Include Verbose configuration data in the report -f File containing the body of the report. Use this to quickly send a prepared report. -p File containing a patch or other text attachment. Separate multiple files with commas. -F File to output the resulting report to. Defaults to '$outfile'. -S Save or send the report without asking for confirmation. -a Send the report to this address, instead of saving to a file. -c Address to send copy of report to. Defaults to '$cc'. -C Don't send copy to administrator. -s Subject to include with the report. You will be prompted if you don't supply one on the command line. -b Body of the report. If not included on the command line, or in a file with -f, you will get a chance to edit the report. -r Your return address. The program will ask you to confirm this if you don't give it here. -e Editor to use. -t Test mode. -T Thank-you mode. The target address defaults to '$thanksaddress'. -d Data mode. This prints out your configuration data, without mailing anything. You can use this with -v to get more complete data. -ok Report successful build on this system to perl porters (use alone or with -v). Only use -ok if *everything* was ok: if there were *any* problems at all, use -nok. -okay As -ok but allow report from old builds. -nok Report unsuccessful build on this system to perl porters (use alone or with -v). You must describe what went wrong in the body of the report which you will be asked to edit. -nokay As -nok but allow report from old builds. -h Print this help message.
EOF}
sub filename { if ($::HaveTemp) { # Good. Use a secure temp file my ($fh, $filename) = File::Temp::tempfile(UNLINK => 1); close($fh); return $filename; } else { # Bah. Fall back to doing things less securely. my $dir = File::Spec->tmpdir(); $filename = "bugrep0$$"; $filename++ while -e File::Spec->catfile($dir, $filename); $filename = File::Spec->catfile($dir, $filename); }}
sub paraprint { my @paragraphs = split /\n{2,}/, "@_"; for (@paragraphs) { # implicit local $_ s/(\S)\s*\n/$1 /g; write; print "\n"; }}
sub _prompt { my ($explanation, $prompt, $default) = (@_); if ($explanation) { print "\n\n"; paraprint $explanation; } print $prompt. ($default ? " [$default]" :''). ": "; my $result = scalar(<>); return $default if !defined $result; # got eof chomp($result); $result =~ s/^\s*(.*?)\s*$/$1/s; if ($default && $result eq '') { return $default; } else { return $result; }}
sub _build_header { my %attr = (@_);
my $head = ''; for my $header (keys %attr) { $head .= "$header: ".$attr{$header}."\n"; } return $head;}
sub _message_headers { my %headers = ( To => $address || 'perl5-porters@perl.org', Subject => $subject ); $headers{'Cc'} = $cc if ($cc); $headers{'Message-Id'} = $messageid if ($messageid); $headers{'Reply-To'} = $from if ($from); $headers{'From'} = $from if ($from); if ($have_attachment) { $headers{'MIME-Version'} = '1.0'; $headers{'Content-Type'} = qq{multipart/mixed; boundary=\"$mime_boundary\"}; } return \%headers;}
sub _add_body_start { my $body_start = <<"BODY_START";This is a multi-part message in MIME format.--$mime_boundaryContent-Type: text/plain; format=fixedContent-Transfer-Encoding: 8bit
BODY_START return $body_start;}
sub _add_attachments { my $attach = ''; for my $attachment (split /\s*,\s*/, $attachments) { my $attach_file = basename($attachment); $attach .= <<"ATTACHMENT";
--$mime_boundaryContent-Type: text/x-patch; name="$attach_file"Content-Transfer-Encoding: 8bitContent-Disposition: attachment; filename="$attach_file"
ATTACHMENT
open my $attach_fh, '<:raw', $attachment or die "Couldn't open attachment '$attachment': $!\n"; while (<$attach_fh>) { $attach .= $_; } close($attach_fh) or die "Error closing attachment '$attachment': $!"; }
$attach .= "\n--$mime_boundary--\n"; return $attach;}
sub _read_report { my $fname = shift; my $content; open( REP, "<:raw", $fname ) or die "Couldn't open file '$fname': $!\n"; binmode(REP, ':raw :crlf') if $Is_MSWin32; # wrap long lines to make sure the report gets delivered local $Text::Wrap::columns = 900; local $Text::Wrap::huge = 'overflow'; while (<REP>) { if ($::HaveWrap && /\S/) { # wrap() would remove empty lines $content .= Text::Wrap::wrap(undef, undef, $_); } else { $content .= $_; } } close(REP) or die "Error closing report file '$fname': $!"; return $content;}
sub build_complete_message { my $content = _build_header(%{_message_headers()}) . "\n\n"; $content .= _add_body_start() if $have_attachment; $content .= _read_report($filename); $content .= _add_attachments() if $have_attachment; return $content;}
sub save_message_to_disk { my $file = shift;
if (-e $file) { my $response = _prompt( '', "Overwrite existing '$file'", 'n' ); return undef unless $response =~ / yes | y /xi; } open OUTFILE, '>:raw', $file or do { warn "Couldn't open '$file': $!\n"; return undef}; binmode(OUTFILE, ':raw :crlf') if $Is_MSWin32;
print OUTFILE build_complete_message(); close(OUTFILE) or do { warn "Error closing $file: $!"; return undef }; print "\nReport saved to '$file'. Please submit it to https://github.com/Perl/perl5/issues\n"; return 1;}
sub _send_message_vms {
my $mail_from = $from; my $rcpt_to_to = $address; my $rcpt_to_cc = $cc;
map { $_ =~ s/^[^<]*<//; $_ =~ s/>[^>]*//; } ($mail_from, $rcpt_to_to, $rcpt_to_cc);
if ( open my $sff_fh, '|-:raw', 'MCR TCPIP$SYSTEM:TCPIP$SMTP_SFF.EXE SYS$INPUT:' ) { print $sff_fh "MAIL FROM:<$mail_from>\n"; print $sff_fh "RCPT TO:<$rcpt_to_to>\n"; print $sff_fh "RCPT TO:<$rcpt_to_cc>\n" if $rcpt_to_cc; print $sff_fh "DATA\n"; print $sff_fh build_complete_message(); my $success = close $sff_fh; if ($success ) { print "\nMessage sent\n"; return; } } die "Mail transport failed (leaving bug report in $filename): $^E\n";}
sub _send_message_mailsend { my $msg = Mail::Send->new(); my %headers = %{_message_headers()}; for my $key ( keys %headers) { $msg->add($key => $headers{$key}); }
$fh = $msg->open; binmode($fh, ':raw'); print $fh _add_body_start() if $have_attachment; print $fh _read_report($filename); print $fh _add_attachments() if $have_attachment; $fh->close or die "Error sending mail: $!";
print "\nMessage sent.\n";}
sub _probe_for_sendmail { my $sendmail = ""; for (qw(/usr/lib/sendmail /usr/sbin/sendmail /usr/ucblib/sendmail)) { $sendmail = $_, last if -e $_; } if ( $^O eq 'os2' and $sendmail eq "" ) { my $path = $ENV{PATH}; $path =~ s:\\:/:; my @path = split /$Config{'path_sep'}/, $path; for (@path) { $sendmail = "$_/sendmail", last if -e "$_/sendmail"; $sendmail = "$_/sendmail.exe", last if -e "$_/sendmail.exe"; } } return $sendmail;}
sub _send_message_sendmail { my $sendmail = _probe_for_sendmail(); unless ($sendmail) { my $message_start = !$Is_Linux && !$Is_OpenBSD ? <<'EOT' : <<'EOT';It appears that there is no program which looks like "sendmail" onyour system and that the Mail::Send library from CPAN isn't available.EOTIt appears that there is no program which looks like "sendmail" onyour system.EOT paraprint(<<"EOF"), die "\n";$message_startBecause of this, there's no easy way to automatically send yourreport.
A copy of your report has been saved in '$filename' for you tosend to '$address' with your normal mail client.EOF }
open( SENDMAIL, "|-:raw", $sendmail, "-t", "-oi", "-f", $from ) || die "'|$sendmail -t -oi -f $from' failed: $!"; print SENDMAIL build_complete_message(); if ( close(SENDMAIL) ) { print "\nMessage sent\n"; } else { warn "\nSendmail returned status '", $? >> 8, "'\n"; }}
# a strange way to check whether any significant editing# has been done: check whether any new non-empty lines# have been added.
sub _fingerprint_lines_in_report { my $new_lines = 0; # read in the report template once so that # we can track whether the user does any editing. # yes, *all* whitespace is ignored.
open(REP, '<:raw', $filename) or die "Unable to open report file '$filename': $!\n"; binmode(REP, ':raw :crlf') if $Is_MSWin32; while (my $line = <REP>) { $line =~ s/\s+//g; $new_lines++ if (!$REP{$line});
} close(REP) or die "Error closing report file '$filename': $!"; # returns the number of lines with content that wasn't there when last we looked return $new_lines;}
format STDOUT =^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~$_.
__END__
=head1 NAME
perlbug - how to submit bug reports on Perl
=head1 SYNOPSIS
B<perlbug>
B<perlbug> S<[ B<-v> ]> S<[ B<-a> I<address> ]> S<[ B<-s> I<subject> ]>S<[ B<-b> I<body> | B<-f> I<inputfile> ]> S<[ B<-F> I<outputfile> ]>S<[ B<-r> I<returnaddress> ]>S<[ B<-e> I<editor> ]> S<[ B<-c> I<adminaddress> | B<-C> ]>S<[ B<-S> ]> S<[ B<-t> ]> S<[ B<-d> ]> S<[ B<-h> ]> S<[ B<-T> ]>
B<perlbug> S<[ B<-v> ]> S<[ B<-r> I<returnaddress> ]> S<[ B<-ok> | B<-okay> | B<-nok> | B<-nokay> ]>
B<perlthanks>
=head1 DESCRIPTION
This program is designed to help you generate bug reports(and thank-you notes) about perl5 and the modules which ship with it.
In most cases, you can just run it interactively from a commandline without any special arguments and follow the prompts.
If you have found a bug with a non-standard port (one that was notpart of the I<standard distribution>), a binary distribution, or anon-core module (such as Tk, DBI, etc), then please see thedocumentation that came with that distribution to determine thecorrect place to report bugs.
Bug reports should be submitted to the GitHub issue tracker atL<https://github.com/Perl/perl5/issues>. The B<perlbug@perl.org>address no longer automatically opens tickets. You can use this toolto compose your report and save it to a file which you can then submitto the issue tracker.
In extreme cases, B<perlbug> may not work well enough on your systemto guide you through composing a bug report. In those cases, youmay be able to use B<perlbug -d> or B<perl -V> to get systemconfiguration information to include in your issue report.
When reporting a bug, please run through this checklist:
=over 4
=item What version of Perl you are running?
Type C<perl -v> at the command line to find out.
=item Are you running the latest released version of perl?
Look at L<http://www.perl.org/> to find out. If you are not using thelatest released version, please try to replicate your bug on thelatest stable release.
Note that reports about bugs in old versions of Perl, especiallythose which indicate you haven't also tested the current stablerelease of Perl, are likely to receive less attention from thevolunteers who build and maintain Perl than reports about bugs inthe current release.
This tool isn't appropriate for reporting bugs in any versionprior to Perl 5.0.
=item Are you sure what you have is a bug?
A significant number of the bug reports we get turn out to bedocumented features in Perl. Make sure the issue you've run intoisn't intentional by glancing through the documentation that comeswith the Perl distribution.
Given the sheer volume of Perl documentation, this isn't a trivialundertaking, but if you can point to documentation that suggeststhe behaviour you're seeing is I<wrong>, your issue is likely toreceive more attention. You may want to start with B<perldoc>L<perltrap> for pointers to common traps that new (and experienced)Perl programmers run into.
If you're unsure of the meaning of an error message you've runacross, B<perldoc> L<perldiag> for an explanation. If the messageisn't in perldiag, it probably isn't generated by Perl. You mayhave luck consulting your operating system documentation instead.
If you are on a non-UNIX platform B<perldoc> L<perlport>, as somefeatures may be unimplemented or work differently.
You may be able to figure out what's going wrong using the Perldebugger. For information about how to use the debugger B<perldoc>L<perldebug>.
=item Do you have a proper test case?
The easier it is to reproduce your bug, the more likely it will befixed -- if nobody can duplicate your problem, it probably won't be addressed.
A good test case has most of these attributes: short, simple code;few dependencies on external commands, modules, or libraries; noplatform-dependent code (unless it's a platform-specific bug);clear, simple documentation.
A good test case is almost always a good candidate to be included inPerl's test suite. If you have the time, consider writing your test case sothat it can be easily included into the standard test suite.
=item Have you included all relevant information?
Be sure to include the B<exact> error messages, if any."Perl gave an error" is not an exact error message.
If you get a core dump (or equivalent), you may use a debugger(B<dbx>, B<gdb>, etc) to produce a stack trace to include in the bugreport.
NOTE: unless your Perl has been compiled with debug info(often B<-g>), the stack trace is likely to be somewhat hard to usebecause it will most probably contain only the function names and nottheir arguments. If possible, recompile your Perl with debug info andreproduce the crash and the stack trace.
=item Can you describe the bug in plain English?
The easier it is to understand a reproducible bug, the more likelyit will be fixed. Any insight you can provide into the problemwill help a great deal. In other words, try to analyze the problem(to the extent you can) and report your discoveries.
=item Can you fix the bug yourself?
If so, that's great news; bug reports with patches are likely toreceive significantly more attention and interest than those withoutpatches. Please submit your patch via the GitHub Pull Request workflowas described in B<perldoc> L<perlhack>. You may also send patches toB<perl5-porters@perl.org>. When sending a patch, create it usingC<git format-patch> if possible, though a unified diff created withC<diff -pu> will do nearly as well.
Your patch may be returned with requests for changes, or requests for moredetailed explanations about your fix.
Here are a few hints for creating high-quality patches:
Make sure the patch is not reversed (the first argument to diff istypically the original file, the second argument your changed file).Make sure you test your patch by applying it with C<git am> or theC<patch> program before you send it on its way. Try to follow thesame style as the code you are trying to patch. Make sure your patchreally does work (C<make test>, if the thing you're patching is coveredby Perl's test suite).
=item Can you use C<perlbug> to submit a thank-you note?
Yes, you can do this by either using the C<-T> option, or by invokingthe program as C<perlthanks>. Thank-you notes are good. It makes peoplesmile.
=back
Please make your issue title informative. "a bug" is not informative.Neither is "perl crashes" nor is "HELP!!!". These don't help. A compactdescription of what's wrong is fine.
Having done your bit, please be prepared to wait, to be told thebug is in your code, or possibly to get no reply at all. Thevolunteers who maintain Perl are busy folks, so if your problem isan obvious bug in your own code, is difficult to understand or isa duplicate of an existing report, you may not receive a personalreply.
If it is important to you that your bug be fixed, do monitor theissue tracker (you will be subscribed to notifications for issues yousubmit or comment on) and the commit logs to developmentversions of Perl, and encourage the maintainers with kind words oroffers of frosty beverages. (Please do be kind to the maintainers.Harassing or flaming them is likely to have the opposite effect of theone you want.)
Feel free to update the ticket about your bug onL<https://github.com/Perl/perl5/issues>if a new version of Perl is released and your bug is still present.
=head1 OPTIONS
=over 8
=item B<-a>
Address to send the report to instead of saving to a file.
=item B<-b>
Body of the report. If not included on the command line, orin a file with B<-f>, you will get a chance to edit the report.
=item B<-C>
Don't send copy to administrator when sending report by mail.
=item B<-c>
Address to send copy of report to when sending report by mail.Defaults to the address of thelocal perl administrator (recorded when perl was built).
=item B<-d>
Data mode (the default if you redirect or pipe output). This prints outyour configuration data, without saving or mailing anything. You can usethis with B<-v> to get more complete data.
=item B<-e>
Editor to use.
=item B<-f>
File containing the body of the report. Use this to quickly send aprepared report.
=item B<-F>
File to output the results to. Defaults to B<perlbug.rep>.
=item B<-h>
Prints a brief summary of the options.
=item B<-ok>
Report successful build on this system to perl porters. Forces B<-S>and B<-C>. Forces and supplies values for B<-s> and B<-b>. Onlyprompts for a return address if it cannot guess it (for use withB<make>). Honors return address specified with B<-r>. You can use thiswith B<-v> to get more complete data. Only makes a report if thissystem is less than 60 days old.
=item B<-okay>
As B<-ok> except it will report on older systems.
=item B<-nok>
Report unsuccessful build on this system. Forces B<-C>. Forces andsupplies a value for B<-s>, then requires you to edit the reportand say what went wrong. Alternatively, a prepared report may besupplied using B<-f>. Only prompts for a return address if itcannot guess it (for use with B<make>). Honors return addressspecified with B<-r>. You can use this with B<-v> to get morecomplete data. Only makes a report if this system is less than 60days old.
=item B<-nokay>
As B<-nok> except it will report on older systems.
=item B<-p>
The names of one or more patch files or other text attachments to beincluded with the report. Multiple files must be separated with commas.
=item B<-r>
Your return address. The program will ask you to confirm its defaultif you don't use this option.
=item B<-S>
Save or send the report without asking for confirmation.
=item B<-s>
Subject to include with the report. You will be prompted if you don'tsupply one on the command line.
=item B<-t>
Test mode. Makes it possible to command perlbug from a pipe or file, fortesting purposes.
=item B<-T>
Send a thank-you note instead of a bug report.
=item B<-v>
Include verbose configuration data in the report.
=back
=head1 AUTHORS
Kenneth Albanowski (E<lt>kjahds@kjahds.comE<gt>), subsequentlyI<doc>tored by Gurusamy Sarathy (E<lt>gsar@activestate.comE<gt>),Tom Christiansen (E<lt>tchrist@perl.comE<gt>), Nathan Torkington(E<lt>gnat@frii.comE<gt>), Charles F. Randall (E<lt>cfr@pobox.comE<gt>),Mike Guy (E<lt>mjtg@cam.ac.ukE<gt>), Dominic Dunlop(E<lt>domo@computer.orgE<gt>), Hugo van der Sanden (E<lt>hv@crypt.orgE<gt>),Jarkko Hietaniemi (E<lt>jhi@iki.fiE<gt>), Chris Nandor(E<lt>pudge@pobox.comE<gt>), Jon Orwant (E<lt>orwant@media.mit.eduE<gt>,Richard Foley (E<lt>richard.foley@rfi.netE<gt>), Jesse Vincent(E<lt>jesse@bestpractical.comE<gt>), and Craig A. Berry (E<lt>craigberry@mac.comE<gt>).
=head1 SEE ALSO
perl(1), perldebug(1), perldiag(1), perlport(1), perltrap(1),diff(1), patch(1), dbx(1), gdb(1)
=head1 BUGS
None known (guess what must have been used to report them?)
=cut
data/miniconda3/bin/activateAdded+6
data/miniconda3/bin/acyclicAdded
data/miniconda3/bin/adigAdded
data/miniconda3/bin/ahostAdded
data/miniconda3/bin/bdftogdAdded+204
data/miniconda3/bin/bzcmpAdded+76
data/miniconda3/bin/bzdiffAdded+76
data/miniconda3/bin/cairo-traceAdded+136
data/miniconda3/bin/ccompsAdded
data/miniconda3/bin/circoAdded
data/miniconda3/bin/convertAdded
data/miniconda3/bin/cphAdded+11
data/miniconda3/bin/dbus-cleanup-socketsAdded
data/miniconda3/bin/dot2gxlAdded
data/miniconda3/bin/f2pyAdded+7
data/miniconda3/bin/fc-cacheAdded
data/miniconda3/bin/fc-listAdded
data/miniconda3/bin/fc-scanAdded
data/miniconda3/bin/fonttoolsAdded+7
data/miniconda3/bin/fribidiAdded
data/miniconda3/bin/gd2togifAdded
data/miniconda3/bin/gdtopngAdded
data/miniconda3/bin/gettext.shAdded+135
data/miniconda3/bin/gif2webpAdded
data/miniconda3/bin/gifclrmpAdded
data/miniconda3/bin/gtscheckAdded
data/miniconda3/bin/gvpackAdded
data/miniconda3/bin/gvprAdded
data/miniconda3/bin/hb-subsetAdded
data/miniconda3/bin/icu-configAdded+771
data/miniconda3/bin/icuinfoAdded
data/miniconda3/bin/idn2Added
data/miniconda3/bin/jpegtranAdded
data/miniconda3/bin/json_ppAdded+240
data/miniconda3/bin/libdeflate-gunzipAdded
data/miniconda3/bin/lzcmpAdded+220
data/miniconda3/bin/lzgrepAdded+300
data/miniconda3/bin/lzmoreAdded+80
data/miniconda3/bin/magickAdded
data/miniconda3/bin/msgcommAdded
data/miniconda3/bin/msgconvAdded
data/miniconda3/bin/msginitAdded
data/miniconda3/bin/msgunfmtAdded
data/miniconda3/bin/msguniqAdded
data/miniconda3/bin/ngettextAdded
data/miniconda3/bin/nviselAdded+7
data/miniconda3/bin/perlAdded
data/miniconda3/bin/perlbugAdded+1518
data/miniconda3/bin/perlthanksAdded+1518
data/miniconda3/bin/pngfixAdded