Today (Saturday) We will make some minor tuning adjustments to MySQL.

You may experience 2 up to 10 seconds "glitch time" when we restart MySQL. We expect to make these adjustments around 1AM Eastern Daylight Saving Time (EDT) US.


RHEL7 dos2UNIX return code 13


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
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; 01-11-2019 at 12:59 AM.. Reason: Added Code Tag and Gave Code Tag Warning to User. Please read the rules. They are important.
# 2  
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; 01-11-2019 at 06:29 AM..
# 3  
What be the output of dos2unix -V on either system?
# 4  
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; 01-12-2019 at 10:10 AM.. Reason: Code Tags
# 5  
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  
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  
Still as an option to check access by acl and entry into groups
Code:
getacl
groups

Login or Register to Reply

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

More UNIX and Linux Forum Topics You Might Find Helpful
RHEL7 - Samba
christr
I'm having trouble with a Linux Samba share after migrating a system from RHEL 5 to RHEL 7. My current configuration is below. workgroup = DOCS security = share comment = Data path = /export read only = yes guest ok = yes browsable = yes In RHEL7 the service will fail to...... Red Hat
1
Red Hat
How to sync time with bios in rhel7?
kalpeer
Hi All, I deployed the rhel7 server in the bare metal hardware. I want to configure the rhel7 server to sync time with bios. I tired the below commands. Still it did not sync the time with bios. Thanks, Kalai... Red Hat
3
Red Hat
Return for Dos2UNIX
tarreddy
Hi, I have to test to see if dos2unix is installed on the machine. Right now I am typing in dos2unix and hitting ctrl C. Is there a better workaround for this. If dos2unix is there is need to print the statement saying its there and vice versa. How can i accomplish this. thank you in...... Shell Programming and Scripting
1
Shell Programming and Scripting
return value of dos2unix
manojn
if (my $temp2=$b2e_r->cmd(cmd=>"dos2unix $b2e_file_name")) Even if it fails as, Jul 25 17:17:02 dos2unix /volume/systest/hello_manoj.results dos2unix /volume/systest/hello_manoj.results dos2unix: converting file /volume/systest/hello_manoj.results to UNIX format ... Failed to open...... UNIX for Dummies Questions & Answers
3
UNIX for Dummies Questions & Answers
to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 's
manas6
Hi All, Can anyone please let me know the syntax / how to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 'system()' function and '${?}'. I am in a process to send the mail automatically with an attachment to bulk users. I have used 'Mailx' and 'Unencode'...... UNIX for Dummies Questions & Answers
0
UNIX for Dummies Questions & Answers

Featured Tech Videos