LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-25-2008, 07:09 PM   #1
jaewoong.kim
LQ Newbie
 
Registered: Dec 2008
Posts: 4

Rep: Reputation: 0
dos2unix - problems renaming tmpfile to outfile


Hi,

recently i have experienced weird problem using dos2unix. seems like converting process looks ok, but renaming tmpfile to outfile has problem like below.

Code:
root@myConsole:/data/customer.cfg/dbmtdpps/work_dir.dpp # /usr/bin/dos2unix pesc.add /tmp/pesc.add
dos2unix: converting file pesc.add to UNIX format ...
dos2unix: problems renaming './u2dtmp8jwsge' to 'pesc.add'
          output file remains in './u2dtmp8jwsge'
dos2unix: problems converting file pesc.add


has anyone experienced same issue?
i'm using dos2unix 3.0 under SuSE.
please help.
 
Old 12-26-2008, 11:29 AM   #2
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
I've sometimes had issues similar to that. I found life is a lot easier with dos2unix and unix2dos when both source and destination files are in your current working directory.
 
Old 12-28-2008, 10:55 PM   #3
jaewoong.kim
LQ Newbie
 
Registered: Dec 2008
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks,
but same problem running dos2unix with source & dest in same working directory.

eg.
-------------------------------------
dos2unix myfile // or myfile myfile2
-------------------------------------

Is there any possible scratch in code level??? i remember there was kinda old thread regarding similar error in dos2unix.

thanks.
 
Old 12-29-2008, 12:58 AM   #4
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,039

Rep: Reputation: 98
Using sed you could do:
Code:
#!/bin/bash
##
## ^M in next line is created by pressing Ctrl+v then Ctrl+m
sed 's/^M$//' $1 > $2
or directly from the command line:
sed 's/^M$//' origfile > newfile

Last edited by Disillusionist; 12-29-2008 at 01:02 AM.
 
Old 12-29-2008, 03:36 AM   #5
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Quote:
Originally Posted by Disillusionist View Post
or directly from the command line:
sed 's/^M$//' origfile > newfile
I just learned something with that Ctl-v trick! Thanks

If you don't like dealing with the control characters and you simply want to strip out all carriage returns (whether or not they immediately precede a newline) you can also:

Code:
cat origfile | tr -d "\r" > newfile
As far as unix2dos/dos2unix are concerned, I just looked around at the versions I had and discovered those files on my Ubuntu system are actually symlinks to todos/fromdos, which appear to be by a different author (and lower revision numbers). So you could also check out that package (probably have to compile it yourself) and see if you have any better luck.
 
Old 12-31-2008, 05:25 AM   #6
jaewoong.kim
LQ Newbie
 
Registered: Dec 2008
Posts: 4

Original Poster
Rep: Reputation: 0
hi,
check this out, i managed to find related thread as i remember; i read similar bugs before.
build version 3 seems to have an issue.

Bug 150277 - problems renaming tmpfile to outfile

Quote:
Bug 150277 - problems renaming tmpfile to outfile
Status: CLOSED RAWHIDE
Product: Fedora
Component: dos2unix (Show Fedora/dos2unix bugs)
Version: 3
Platform: All Linux
Priority: medium Severity: medium
Target Milestone: ---
Assigned To: Tim Waugh
QA Contact: Ben Levenson
Quote:
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3)
Gecko/20041020 Epiphany/1.4.4

Description of problem:
The problem is in 'dos2unix-3.1-tmppath.patch'. Memory for the null
terminator is not being allocated.

this code:
fname_len = strlen(dir) + strlen("/d2utmpXXXXXX");

should be:
fname_len = strlen(dir) + strlen("/d2utmpXXXXXX") + sizeof(char);

Version-Release number of selected component (if applicable):
dos2unix-3.1-21

How reproducible:
Sometimes

Steps to Reproduce:
1. dos2unix ./source/common/launch.h



Actual Results: dos2unix: converting file ./source/common/launch.h to
UNIX format ...
dos2unix: problems renaming './source/common/d2utmptfS3dJ' to
'./source/common/launch.h'
output file remains in './source/common/d2utmptfS3dJ'

Last edited by jaewoong.kim; 12-31-2008 at 05:27 AM.
 
  


Reply

Tags
renaming



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
unix2dos problems renaming converted file smilingdragon Linux - Software 6 12-31-2008 05:35 AM
Use of dos2unix command Karthikeyan Gurusamy Linux - Newbie 3 02-02-2006 06:32 AM
dos2unix command on a folder raghunandan Linux - Software 1 12-12-2005 07:50 AM
FC3 font problems - accent display - renaming error tomhemba Fedora 8 01-17-2005 02:33 PM
dos2unix package alaios Debian 1 01-16-2005 06:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration