* [9fans] 5c bug
@ 2019-07-25 11:19 Steve Simon
2019-07-25 11:59 ` Charles Forsyth
0 siblings, 1 reply; 2+ messages in thread
From: Steve Simon @ 2019-07-25 11:19 UTC (permalink / raw)
To: 9fans
Hi,
I traced a long standing cifs issue to 5c the compiler.
The code in lib9p to validate wstat calls
uses a neat bit of casting which fails when using 5c.
/sys/src/lib9p/srv.c:658-669
These following lines missfire reporting type or qid change
when trying to rename files over cifs.
if((ushort)~r->d.type){
...
if((uchar)~r->d.qid.type || .. ){
but rewriting them like this makes the code work as expected:
if(r->d.type != (ushort)~0){
...
if(r->d.qid.type != (uchar)~0 || ... )
Personally I am happy to hack lib9p but the worry is that
this bug might be affecting other things.
I have no knowledge of the internals of the compilers so
I am afraid I have made no attempt to dig deeper.
-Steve
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [9fans] 5c bug
2019-07-25 11:19 [9fans] 5c bug Steve Simon
@ 2019-07-25 11:59 ` Charles Forsyth
0 siblings, 0 replies; 2+ messages in thread
From: Charles Forsyth @ 2019-07-25 11:59 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
[-- Attachment #1: Type: text/plain, Size: 1094 bytes --]
5c shouldn't discard the cast, which implies a mask, but you should also
rewrite the code as you suggest.
(it's not just 5c, since it's the same for several other RISCy ones.)
On Thu, Jul 25, 2019 at 12:20 PM Steve Simon <steve@quintile.net> wrote:
> Hi,
>
> I traced a long standing cifs issue to 5c the compiler.
>
> The code in lib9p to validate wstat calls
> uses a neat bit of casting which fails when using 5c.
>
> /sys/src/lib9p/srv.c:658-669
>
> These following lines missfire reporting type or qid change
> when trying to rename files over cifs.
>
> if((ushort)~r->d.type){
> ...
> if((uchar)~r->d.qid.type || .. ){
>
> but rewriting them like this makes the code work as expected:
>
> if(r->d.type != (ushort)~0){
> ...
> if(r->d.qid.type != (uchar)~0 || ... )
>
> Personally I am happy to hack lib9p but the worry is that
> this bug might be affecting other things.
>
> I have no knowledge of the internals of the compilers so
> I am afraid I have made no attempt to dig deeper.
>
> -Steve
>
>
[-- Attachment #2: Type: text/html, Size: 1505 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-25 11:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-25 11:19 [9fans] 5c bug Steve Simon
2019-07-25 11:59 ` Charles Forsyth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).