Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stdin doesn't work #7

Closed
stsp opened this issue May 12, 2018 · 3 comments
Closed

stdin doesn't work #7

stsp opened this issue May 12, 2018 · 3 comments

Comments

@stsp
Copy link
Member

stsp commented May 12, 2018

Reading from stdin always returns error.

@stsp
Copy link
Member Author

stsp commented May 20, 2018

get_sft_idx() returns DE_INVLDHNDL with
this code:

  idx = p->ps_filetab[hndl];
  return idx == 0xff ? DE_INVLDHNDL : idx;

so p->ps_filetab[0] == 0xff, which causes
the error to be returned when reading from stdin.

@bartoldeman Could you please hint me where
to look? Where should the ps_filetab be initialized
for stdin?
I also see this code:

/* if the sft is invalid, then we just monitor syscon */
struct dhdr FAR *sft_to_dev(sft FAR *s)
{
  if (FP_OFF(s) == (UWORD) -1)
    return syscon;

but DosRWSft() doesn't have such fall-back.

@stsp
Copy link
Member Author

stsp commented May 20, 2018

OK, looks like FsConfig() does this.
Looking...

@stsp
Copy link
Member Author

stsp commented May 20, 2018

OK, the bug seems to be in truename().
It gets called to open AUX and errors here:

  dhp = IsDevice(src);
    
  cdsEntry = get_cds(result);
  if (cdsEntry == NULL)
  {
    /* workaround for a device prefixed with invalid drive (e.g. "@:NUL") */
    /* (MS-DOS always return drive P: for invalid drive. Why P:?) */
    if (dhp)
    {
      result = default_drive;
      cdsEntry = get_cds(result);
      if (cdsEntry == NULL)
        return DE_PATHNOTFND;
    }

So it correctly finds device header, but,
since I have no drives defined, it can't
find CDS for default_drive and returns
an error. IMHO when opening the devices
like AUX, the missing drive should not
cause any failure. So I think this is a freedos
bug.
@bartoldeman Could you please clarify?

stsp added a commit that referenced this issue May 21, 2018
@stsp stsp closed this as completed in b544dff Jul 5, 2018
stsp added a commit that referenced this issue Oct 30, 2018
This reverts commit b544dff.

Reverting this not because its wrong, but because it prevents
reverting another patch.
stsp added a commit that referenced this issue Oct 30, 2018
Allow IS_DEVICE w/o CDS only if fall-back to default drive
happened as a result of not specified drive. In case of an
explicitly specified invalid drive, we are not interested
in IsDevice() check.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant