(CommandList children: [ (Sentence child: (C {(.)} { (DQ (BracedVarSub token: <VSub_Name srcdir> suffix_op: (StringUnary op_id:VTest_Equals arg_word:{(.)}) spids: [50 54] ) (/tests/init.sh) ) } ) terminator: <Op_Semi ';'> ) (C {(path_prepend_)} {(./src)}) (C {(print_ver_)} {(pwd)}) (C {(require_readable_root_)}) (C {(require_perl_)}) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:ARGV_0) op:Equal rhs:{($ VSub_Number '$0')} spids:[73])] spids: [73] ) (C {(export)} {(ARGV_0)}) (SimpleCommand words: [ {($ VSub_Name '$PERL')} {(-Tw)} {(-I) (DQ ($ VSub_Name '$abs_srcdir') (/tests))} {(-MCuSkip)} {(--)} {(-)} ] redirects: [ (HereDoc op_id: Redir_DLess fd: 16777215 body: {('\n') ('# Show that pwd works even when the length of the resulting\n') ('# directory name is longer than PATH_MAX.\n') ('use strict;\n') ('\n') ('(my $ME = $ENV{ARGV_0}) =~ s|.*/||;\n') ('\n') ('sub normalize_to_cwd_relative ($$$)\n') ('{\n') (' my ($dir, $dev, $ino) = @_;\n') (' my $slash = -1;\n') (' my $next_slash;\n') (' while (1)\n') (' {\n') (" $slash = index $dir, '/', $slash + 1;\n") (' $slash <= -1\n') (' and die "$ME: $dir does not contain old CWD\\n";\n') (" my $dir_prefix = $slash ? substr ($dir, 0, $slash) : '/';\n") (' my ($d, $i) = (stat $dir_prefix)[0, 1];\n') (' defined $d && defined $i\n') (' or die "$ME: $dir_prefix: stat failed: $!\\n";\n') (' $d eq $dev && $i eq $ino\n') (' and return substr $dir, $slash + 1;\n') (' }\n') ('}\n') ('\n') ('# Set up a safe, well-known environment\n') ('delete @ENV{qw(BASH_ENV CDPATH ENV)};\n') ("$ENV{IFS} = '';\n") ('\n') ('# Taint checking requires a sanitized $PATH. This script performs no $PATH\n') ('# search, so on most Unix-based systems, it is fine simply to clear $ENV{PATH}.\n') ("# However, on Cygwin, it's used to find cygwin1.dll, so set it.\n") ("$ENV{PATH} = '/bin:/usr/bin';\n") ('\n') ("# Save CWD's device and inode numbers.\n") ("my ($dev, $ino) = (stat '.')[0, 1];\n") ('\n') ('# Construct the expected "."-relative part of pwd\'s output.\n') ("my $z = 'z' x 31;\n") ('my $n = 256;\n') ('my $expected = "/$z" x $n;\n') ('# Remove the leading "/".\n') ("substr ($expected, 0, 1) = '';\n") ('\n') ('my $i = 0;\n') ('do\n') (' {\n') (' mkdir $z, 0700\n') (' or CuSkip::skip "$ME: skipping this test; cannot create long "\n') (' . "directory name at depth $i: $!\\n";\n') (' chdir $z\n') (' }\n') ('until (++$i == $n);\n') ('\n') ('my $abs_top_builddir = $ENV{abs_top_builddir};\n') ('$abs_top_builddir\n') (' or die "$ME: envvar abs_top_builddir not defined\\n";\n') ('my $build_src_dir = "$abs_top_builddir/src";\n') ('$build_src_dir =~ m!^([-+.:/\\w]+)$!\n') ( ' or CuSkip::skip "$ME: skipping this test; odd build source directory name:\\n"\n' ) (' . "$build_src_dir\\n";\n') ('$build_src_dir = $1;\n') ('\n') ('my $pwd_binary = "$build_src_dir/pwd";\n') ('\n') ('-x $pwd_binary\n') (' or die "$ME: $pwd_binary is not an executable file\\n";\n') ('chomp (my $actual = qx!$pwd_binary!);\n') ('\n') ('# Convert the absolute name from pwd into a $CWD-relative name.\n') ('# This is necessary in order to avoid a spurious failure when run\n') ('# from a directory in a bind-mounted partition. What happens is\n') ('# pwd reads a ".." that contains two or more entries with identical\n') ("# dev,ino that match the ones we're looking for, and it chooses a\n") ('# name that does not correspond to the one already recorded in $CWD.\n') ('$actual = normalize_to_cwd_relative $actual, $dev, $ino;\n') ('\n') ('if ($expected ne $actual)\n') (' {\n') (' my $e_len = length $expected;\n') (' my $a_len = length $actual;\n') (' warn "expected len: $e_len\\n";\n') (' warn "actual len: $a_len\\n";\n') (' warn "expected: $expected\\n";\n') (' warn "actual: $actual\\n";\n') (' exit 1;\n') (' }\n') } do_expansion: False here_end: EOF was_filled: T spids: [103] ) ] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:fail) op:Equal rhs:{($ VSub_QMark '$?')} spids:[108])] spids: [108] ) (C {(Exit)} {($ VSub_Name '$fail')}) ] )