RHEL7 dos2UNIX return code 13

Tags
code, dos2unix, red hat, rhel, unix

 
Thread Tools Search this Thread
# 1  
Old 1 Week Ago
RHEL7 dos2UNIX return code 13

Hi, upgraded one of the server to RHEL7. A Shell script uses dos2unix to convert EOL characters to Linux format and checks return code. In RHEL6, if conversion fails shell script returns code 1 where as if conversion fails in RHEL7 script returns return code 13. Is it possible to change RHEL7 return code(13) as in RHEL6 (1) ?

Code:
[satya@rhel6 tmp]$ cat /etc/redhat-release
Red Hat Linux release 6.x
[satya@rhel6 tmp]$ dos2unix testfile
dos2unix: converting file testfile to UNIX format ...
dos2unix: problems converting file testfile
[satya@rhel6 tmp]$ echo $?
1
[satya@rhel6 tmp]$

Code:
[satya@rhel7 tmp]$ cat /etc/redhat-release
Red Hat Linux release 7.x
[satya@rhel7 tmp]$ dos2unix testfile
dos2unix: testfile: Permission denied
dos2unix: converting file testfile to Unix format ...
dos2unix: problems converting file testfile
[satya@rhel7 tmp]$ echo $?
13
[satya@rhel7 tmp]$



thanks
satya

Last edited by Neo; 1 Week Ago at 12:59 AM.. Reason: Added Code Tag and Gave Code Tag Warning to User. Please read the rules. They are important.
# 2  
Old 1 Week Ago
These commands should help
Code:
file testfile
stat testfile
enca testfile

--- Post updated at 10:12 ---

I apologize for the previous post, I did not understand the question, but what does the next command output give here and there?
Code:
dos2unix -i testfile

The point is not in the dos2unix utility but in the file permissions.
I changed the file permissions and got the same error code from any utility!
Code:
chmod 444 file
echo "hi" > file
Permission denied


Last edited by nezabudka; 1 Week Ago at 06:29 AM..
# 3  
Old 1 Week Ago
What be the output of dos2unix -V on either system?
# 4  
Old 1 Week Ago
Thank you for the reply. Java application executes dos2unix on linux box and look for return codes 0(success) or 1(fail). As failure return code changed in RHEL7, java app code failing. so want to get some idea on whether this 13 return code coming from linux or dos2unix utlity.

--- Post updated at 08:34 PM ---

Thank you RudiC, here is the o/p from RHEL7 and RHEL6. Java application executes dos2unix on linux box and look for return codes 0(success) or 1(fail). As failure return code changed in RHEL7, java app code failing. so want to get some idea on whether this 13 return code coming from linux or dos2unix utlity.

Code:
[satya@rhel7 tmp]$ dos2unix -V
dos2unix 6.0.3 (2013-01-25)


[satya@rhel6 ~]$ dos2unix -V
dos2unix 3.1 (Thu Nov 19 1998)


Last edited by Neo; 1 Week Ago at 10:10 AM.. Reason: Code Tags
# 5  
Old 1 Week Ago
The java code is wrong. The standards say that exit code 0 is success and that failure is denoted by a non-zero value (not just 1). Some utilities have other non-zero exit values that still indicate success, but no program should assume that only exit code 1 means failure.

The standards also specify that the some utilities are required to return exit code 126 if an attempt was made to invoke a utility, a utility by that name was found, but the utility was not in the proper form to execute as a utility and to return exit code 127 if an attempt was made to invoke a utility but no utility of the desired name was found.
# 6  
Old 1 Week Ago
First, make sure the two versions react differently to the identical error situation, which is not obvious in post #1. Are both running into the "permission denied" error? If that's the case, and you can't make the java code behave, consider installing the older dos2unix version on the RHEL7 system.
# 7  
Old 1 Week Ago
Still as an option to check access by acl and entry into groups
Code:
getacl
groups


|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
RHEL7 - Samba christr Red Hat 1 09-10-2017 05:35 PM
Instructions for Solaris 10 RedHat RHEL7 IPA for LDAP authentication? ckmehta Solaris 3 08-08-2016 04:26 PM
Command for viewing hba cards on rhel7 gartie Red Hat 0 10-28-2015 11:34 AM
How to sync time with bios in rhel7? kalpeer Red Hat 3 10-06-2015 12:21 PM
Return for Dos2UNIX tarreddy Shell Programming and Scripting 1 01-28-2013 10:50 AM
How could I use the value of return code anuragpgtgerman Shell Programming and Scripting 0 11-23-2011 07:41 PM
return value of dos2unix manojn UNIX for Dummies Questions & Answers 3 07-25-2011 05:07 AM
return code help learnbash Shell Programming and Scripting 5 02-10-2009 01:25 PM
Need help with return code 1... mac4rfree Shell Programming and Scripting 6 12-11-2008 11:47 AM
checking the return code Satyak Shell Programming and Scripting 4 10-16-2008 11:39 AM
to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 's manas6 UNIX for Dummies Questions & Answers 0 06-05-2008 07:44 AM
how to get return code in one line bluemoon1 Shell Programming and Scripting 6 09-13-2007 11:09 PM
asking about return code naamas03 Shell Programming and Scripting 3 08-28-2007 05:53 AM
Return code from system() mradulkaushik Programming 1 01-08-2007 01:27 PM
Return code from PL/SQL Code Shaz UNIX for Advanced & Expert Users 7 06-03-2003 11:56 AM