emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#17637: closed (bug "cut of end-line is skipped")


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#17637: closed (bug "cut of end-line is skipped")
Date: Sun, 01 Jun 2014 12:51:02 +0000

Your message dated Sun, 01 Jun 2014 13:50:20 +0100
with message-id <address@hidden>
and subject line Re: bug#17637: bug "cut of end-line is skipped"
has caused the debbugs.gnu.org bug report #17637,
regarding bug "cut of end-line is skipped"
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
17637: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17637
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: bug "cut of end-line is skipped" Date: Thu, 29 May 2014 23:43:25 +0200 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0
helo, i'm a bash shell script beginner...
forgive my poor English, i'd like to contribute to GNU O.S. reporting this suspect bug.

it was working perfectly the command from
ubuntu 12.04 LTS after installed "at" using the terminal command apt-get install at

#################################
 echo "`atq`" |cut -d$'\n' -f1  | cut -d$'\t' -f1
#################################

return the first number job id  from the scheduler atq Job list.
exaple: 9432 or 9486 or ... 9498

it was working perfectly the follow routine from my implementation for video surveillance in shell script running like root user:
##################################
##################################
#! /bin/sh
#
Kill_All_Jobs()
{
local Job_Pid=""
local Done=false
local Empty=""
while [ "$Done" = false  ]
do
    Job_Pid=""
    # set first line
    Job_Pid=$( echo "`atq`" |cut -d$'\n' -f1 )
    # set first field
    Job_Pid=$( echo "$Job_Pid" | cut -d$'\t' -f1 )
    if [ "$Job_Pid" != "$Empty" ]
    then
        echo "KILLING JOB $Job_Pid"
        at -r "$Job_Pid"
        echo ""
        sleep 1
    else
        Done=true
    fi
done
}
##################################
##################################


Now after Upgrade to ubuntu 14.04 LTS
the command
#################################
 echo "`atq`" |cut -d$'\n' -f1  | cut -d$'\t' -f1
#################################
give to a different output result!
example output is

94234
94356
94237

in the same bash variable..
i hope mistake, i think the cut of tabulator is done but the cut of end-line is skipped! so the result is a set of values that make the routine in loop .. the at -r command can't operate without a correct parameter variable value.

after some time.. i replaced the routine using a rea-file-line instruction and temporarily solved

##################################
Kill_All_Jobs()
{
local Job_Pid=""
local Done=false
local Empty=""
local Temp_location="$VS_ROOT"
local Temp_name="atq.sh"
local Tmp_File="$Temp_location$Temp_name"
local line=""
while [ "$Done" = false  ]
do
    atq > "$Tmp_File"

    Job_Pid=""
    line=""
    while read line
    do
        #set first filed
        Job_Pid=$( echo "$line" | cut -d$'\t' -f1 )
        echo "line..$line..$Job_Pid.."
    done < "$Tmp_File"

    if [ "$Job_Pid" != "$Empty" ]
    then
        echo "KILLING JOB ..$Job_Pid.."
        at -r "$Job_Pid"
        echo ""
        sleep 1
    else
        Done=true
    fi
done
kill "$Tmp_File"
}


##################################
good rule of developing is avoid to use files not necessary...

so i'd like to have reply from the follow questions:
1- what is the correct syntax to use cut with atq command to extract the job id? 2- the output from shell commands use the same field separator and line separator?
3- there is a standar output format or metod from shell commands?

thanks regard ... rudy




--- End Message ---
--- Begin Message --- Subject: Re: bug#17637: bug "cut of end-line is skipped" Date: Sun, 01 Jun 2014 13:50:20 +0100 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2
tags 17637 - notabug

On 05/30/2014 06:43 PM, Pádraig Brady wrote:
> Arguments for reverting to old behavior:
>   compat for coreutils only scripts
>   compat with existing i18n patch in various distros
>   Valid use cases albeit achievable with other utils
> 
> Arguments for keeping new behavior
>   avoids users introducing unneeded GNU extensions to scripts
>   avoids special casing last '\n' in file
>   allows for more efficient implementation
> 
> Compat concerns win here I think so
> I'm 55:45 in favor of applying the attached patch
> to reinstate the functionality.

Pushed.

thanks,
Pádraig.



--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]