First off, our development environment just got upgraded to RHEL 7.5 (Maipo), we were previously on Oracle Solaris 10. Once we switched from Solaris to Red Hat this problem began. The Korn shell script below works correctly in production which is still on Solaris 10. So I am assuming that has something to do with the issue. The zip files that are being zipped up and downloaded are not saving to the zip folder. When I open the zip folder on the desktop that I just downloaded the zip folder is empty.
The pic below shows the file list. The user will select a checkbox for the files they want to download and then they click the zip and download link and it should zip up those selected files and save it to your desktop. Unfortunately the zip folder is empty. Any ideas what the problem may be?
Here is the shell script that is being called below:
1 #!/bin/ksh
2 #
3 # Utility to zip up files in the configuration_aerodynamic_properties area.
4 # Script takes two arguments the directory and the file list.
5 # The file list is tab seperated.
6 # This script returns the zip file.
7 #
8 # $Log: vmdb_zip_files.sh,v $
9 # Revision 1.4 2014/10/21 19:53:31 wmorris1
10 # ASR 13563 - Change incorrect mime type text/text to text/plain.
11 #
12 # Revision 1.3 2012/04/30 18:46:03 wmorris1
13 # ASR 12774 - Fix SSL and IE issue found after going to SSL.
14 #
15 # Revision 1.2 2004/11/11 12:49:33 bmorris
16 # ASR 55414 - removed UNIX groups for zipped file.
17 #
18 # Revision 1.1 2004/10/18 20:10:32 bmorris
19 # Initial revision
20 #
21 #set -x
22 #set -v
23 function error_message {
24 echo "Content-Type: text/plain;"
25 echo "Content-Disposition: attachment; filename=\"download_error.txt\";"
26 COMMAND="unix2dos "
27 echo ""
28 echo "$(${COMMAND} <<-EOF
29 Error: $1
30
31 EOF
32 )"
33 }
34 if [ "$#" -lt 2 ]; then
35 error_message "Insufficient arguments to $(basename $0)!"
36 return 1
37 fi
38 CONTENT="application/x-zip-compressed"
39 # Parse the directory path.
40 # Internal Field Sep (IFS) empty, cause spaces in file names, directories are important
41 IFS=$""
42 FULL_DIRECTORY_PATH=$(echo "${1}" | tr -d '~\\')
43 # File lists are seperated by tabs, parse them
52 IFS=$(printf '\t')
53 set -A FILE_LIST ${2}
54 # Make each of the file parameters in the file list protected.
55 let count=0
56 while (( $count < ${#FILE_LIST[*]} )); do
57 FILE_LIST[count]="\"${FILE_LIST[count]}\""
58 let count="count +1"
59 done
60 # Reset the IFS to the default.
61 IFS=$(echo " \n\t")
62 if [[ -n $3 ]]; then
63 WEB_FILENAME="$3"
64 fi
65 # Don't let the user download stuff.
66 if [[ "${1}" = *..* ]] || [[ "${1}" = *~* ]] || [[ "${2}" = *..* ]] || [[ "${2}" = *~* ]]; then
67 error_message "Path ${1}/${2} violates security."
68 return 1
69 elif [[ ! -f ${FULL_DIRECTORY_PATH} ]] && [[ ! -d ${FULL_DIRECTORY_PATH} ]]; then
70 error_message "${FULL_FILE_PATH} does not exist or is not regular."
71 return 1
72 elif [[ ! -r ${FULL_DIRECTORY_PATH} ]]; then
73 error_message "${FULL_FILE_PATH} is not readable from the web."
74 return 1
75 fi
76 # Zip up the f
79 COMMAND="cd \"${FULL_DIRECTORY_PATH}\"; zip -rX - ${FILE_LIST[*]}"
82 echo "Content-Type: ${CONTENT};"
83 if [[ -z $HTTP_USER_AGENT || $HTTP_USER_AGENT != *MSIE* ]]; then
84 # IE Can't handle ssl and zip files
85 echo "Pragma:no-cache"
86 fi
87
88 echo ""
98 eval "$COMMAND"
I debugged with set -x and here is the error log from the server:
cat vmdb_zip_files_8862.err
+ [ 3 -lt 2 ]
+ CONTENT=application/x-zip-compressed
+ IFS=''
+ tr -d '~\\'
+ echo /isweb/www/ss/issapt/vmdb/data_downloads/power_export
+ FULL_DIRECTORY_PATH=/isweb/www/ss/issapt/vmdb/data_downloads/power_export
+ printf '\t'
+ IFS=$'\t'
+ set -A FILE_LIST flight_dependent_heater_data_443949.txt flight_dependent_data_443949.txt
+ let count=0
+ (( 0 < 2 ))
+ FILE_LIST[0]='"flight_dependent_heater_data_443949.txt"'
+ let count='count +1'
+ (( 1 < 2 ))
+ FILE_LIST[1]='"flight_dependent_data_443949.txt"'
+ let count='count +1'
+ (( 2 < 2 ))
+ echo ' \n\t'
+ IFS=' \n\t'
+ [[ -n power_export.zip ]]
+ WEB_FILENAME=power_export.zip
+ [[ /isweb/www/ss/issapt/vmdb/data_downloads/power_export == *..* ]]
+ [[ /isweb/www/ss/issapt/vmdb/data_downloads/power_export == *~* ]]
+ [[ $'flight_dependent_heater_data_443949.txt\tflight_dependent_data_443949.txt' == *..* ]]
+ [[ $'flight_dependent_heater_data_443949.txt\tflight_dependent_data_443949.txt' == *~* ]]
+ [[ ! -f /isweb/www/ss/issapt/vmdb/data_downloads/power_export ]]
+ [[ ! -d /isweb/www/ss/issapt/vmdb/data_downloads/power_export ]]
+ [[ ! -r /isweb/www/ss/issapt/vmdb/data_downloads/power_export ]]
+ COMMAND='cd "/isweb/www/ss/issapt/vmdb/data_downloads/power_export"; zip -rX - "flight_dependent_heater_data_443949.txt" "flight_dependent_data_443949.txt"'
+ echo 'Content-Type: application/x-zip-compressed;'
+ [[ -z 'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko' ]]
+ [[ 'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko' != *MSIE* ]]
+ echo Pragma:no-cache
+ echo ''
+ eval 'cd "/isweb/www/ss/issapt/vmdb/data_downloads/power_export"; zip -rX - "flight_dependent_heater_data_443949.txt" "flight_dependent_data_443949.txt"'
+ cd /isweb/www/ss/issapt/vmdb/data_downloads/power_export
+ zip -rX - flight_dependent_heater_data_443949.txt flight_dependent_data_443949.txt
eval: zip: cannot execute [Exec format error]
Not sure if zip was installed via a package or compiled manually, I will have to ask sys ops but here is the output of file /usr/bin/zip this gives me /usr/bin/zip: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=747369bd1c41c4f8671a38f0055533a0c19a7769, stripped. As for the command uname -m gives me this result: x86_64
The output for type zip is zip is a tracked alias for /oraloc/app/product/11.2.0/client_1/bin/zip and the output for file $(which zip) is the following /oraloc/app/product/11.2.0/client_1/bin/zip: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.4.0, not stripped.
The output of echo $PATH is the following: /isdev/isapps/vmdb/tools/apache-maven-3.3.9/bin:/isdev/isapps/vmdb/tools/apache-ant-1.9.7/bin:/isdev/isapps/vmdb/runlib/current:/oraloc/app/product/11.2.0/client_1/bin:/oraloc/app/product/11.2.0/client_1/OPatch:/tools/ileaf.ileaf/sun4os5/lib:/tools/ghostscript/current/bin/:/tools/hp2xx/bin/:/usr/lib/lp/postscript/:/tools/ileaf.ileaf/bin/::/tools/gmake/3_79_1/bin:/tools/rcs/current/bin/:/bin:/usr/j2se/bin/:/tools/gcc/3_0_3/bin:/isdev/isapps/vmdb/tools/bin:/homedev/isdev2/cmarti35/tools/java/bin:/usr/sfw/bin:/bin:/usr/bin:/usr/contrib/bin:/usr/local/bin:/usr/bin/X11:/usr/bin/X11:/usr/dt/bin:/etc:/usr/etc:/opt/SUNWmotif/bin:/opt/SUNWspro/SC3.0/bin:/usr/ucb:/usr/sbin:/usr/ccs/bin:/tools/openssh/3.7.1p2/bin/:.:/usr/bin/X11

zip) is executing on a RH Linux host? Was zip installed via a package or compiled manually? (It has the appearance of a wrong-architecture binary). The output offile /usr/bin/zipanduname -mwould help.type zip? andfile $(which zip)?file /usr/bin/zipthis gives me/usr/bin/zip: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=747369bd1c41c4f8671a38f0055533a0c19a7769, stripped. As for the commanduname -mgives me this result:x86_64. Thanks for the help.type zipiszip is a tracked alias for /oraloc/app/product/11.2.0/client_1/bin/zipand the output forfile $(which zip)is the following/oraloc/app/product/11.2.0/client_1/bin/zip: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.4.0, not stripped. What does this mean ? Thanks.echo $PATH?