[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
printf from coreutils 5.2.1 Variable managing problem
From: |
alberto . colosi |
Subject: |
printf from coreutils 5.2.1 Variable managing problem |
Date: |
Sun, 16 Oct 2005 20:56:27 -0000 |
----- Forwarded by Alberto Colosi/SI/RM/GSI/it on 28/10/2004 22.38 -----
Alberto Colosi
16/10/2005 20.29
To: address@hidden, address@hidden
cc:
Subject: KEEP THIS EMAIL! NOT THE PREVIOUS - REPRODUCED
Variabe managing problem
SORRY This is the right example to show the difference between echo and
printf and printf %b
None keeps all the strings back.
I reproduced outside the CGI:
Output:
------------------------------------------
A=V6
5Q3:P2 - V6
5Q3:P2
B=qwerta!1 - qwerta!1
------------------------------------------
A=V6]Q3:P2 - V6]Q3:P2
B=qwerta - qwerta
------------------------------------------
A=V6]Q3:P2 - V6]Q3:P2
B=qwerta - qwerta
------------------------------------------
Script:
#!/bin/bash3
# USER="test"
# OLDP="qwerta!1"
# NEWP1="V6]Q3:P2"
# NEWP2="V6]Q3:P2"
A="V6\0135Q3\072P2"
B="qwerta\0411"
A2=$A
B2=$B
echo "------------------------------------------"
printf "A=$A - $A2\n\r"
printf "B=$B - $B2\n\r"
echo "------------------------------------------"
echo -e "A=$A - $A2"
echo -e "B=$B - $B2"
echo "------------------------------------------"
printf %b "A=$A - $A2\n\r"
printf %b "B=$B - $B2\n\r"
echo "------------------------------------------"
Why don't take back the original code? something is decodifed well and
other in a trash way. For some chars if to printf I add %b is decoded but
is not what was before! so no choice is the winner!. Have I to be sanct to
decode all?
Alberto Colosi
IBM Global Services
IBM Business Consulting Services
Sistemi Informativi S.P.A.
IT/ITS Division
IBM VTS Focal Point per SI
NetWork Control/Operations Center
(NetWork and Security [*Master] office)
SECURITY IS EVERYONE'S BUSINESS
Alberto Colosi
16/10/2005 19.57
To: address@hidden
cc: address@hidden
Subject: Re: Variabe managing problem
I don't think so.
If I use ProcCGIInput.sh I get escaped sequences like:
V6\0135Q3\072P2
qwerta\0411
qwerta\0411
If I don't use it (ProcCGIInput.sh) and I "read" the standard input (the
input of the POST from a simple form via a simple HTML page)
user=test&oldpw=V6%5DQ3%3AP2&newpw1=qwerta%211&newpw2=qwerta%211
All are POSTs type application/x-www-form-urlencoded and to "normalize"
encoded chars I have seen that reasingning the "coded" variable to a new
one take bake the original "special" chars. \0135 go back to
] and \041 go back to !
Now, is clear that BASH know that codes but fail in some conversion. Know
these codes becouse at 90% all is decoded well but some char sometime
fail.
Why it?
Alberto Colosi
IBM Global Services
IBM Business Consulting Services
Sistemi Informativi S.P.A.
IT/ITS Division
IBM VTS Focal Point per SI
NetWork Control/Operations Center
(NetWork and Security [*Master] office)
SECURITY IS EVERYONE'S BUSINESS
Chet Ramey <address@hidden>
16/10/2005 04.32
Please respond to chet.ramey
To: address@hidden
cc: address@hidden
Subject: Re: Variabe managing problem
address@hidden wrote:
> Hi, If I put test as VARIABLE / COSTANTS as OLDP="blablabla" it
> remain unmodified
>
> USER="test"
> OLDP="qwerta!1"
> NEWP1="V6]Q3:P2"
> NEWP2="V6]Q3:P2"
>
> Without %b on onl password this random temporary password while in
change
> password was resulting in V6 Q3:P2 but space is a not
> alloved char.
>
> Without %b qwerta!1 work BAD and change in qwerta! without
> %b qwerta!1 work fine but not V6]Q3:P2
>
> So the trouble is ProcCGIInput.sh ??? but how to take a POST form input?
.
The problem must be somewhere in ProcCGIInput.sh, since I can't
reproduce any bad behavior using a shell script with your variables
and input values.
The POST question I can't help you with.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
Live Strong.
Chet Ramey, ITS, CWRU address@hidden
http://cnswww.cns.cwru.edu/~chet/
- printf from coreutils 5.2.1 Variable managing problem,
alberto . colosi <=