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

io.open() may create invalid stream #523

Open
Night-walker opened this issue Mar 15, 2016 · 10 comments · May be fixed by dumblob/dao#1
Open

io.open() may create invalid stream #523

Night-walker opened this issue Mar 15, 2016 · 10 comments · May be fixed by dumblob/dao#1

Comments

@Night-walker
Copy link

(dao) load stream
= none
(dao) f = io.open('.', 'r')
= FileStream[0x1210920]
@kunal
Copy link

kunal commented Oct 9, 2018

Hello @daokoder,

I am getting started with this. Where should this be handled? As a part of "stream" module or a part of the platform?

@dumblob
Copy link

dumblob commented Oct 10, 2018

Hi @kunal, welcome to this project. I'm glad you're be willing to help us.

Could you please be more specific what you mean by "handled in the platform"? In kernel/daoPlatform.c there you can see Dao_OpenFile() calls directly fopen(). From what I found is it simply undefined if one tries to fopen a directory (see e.g. https://stackoverflow.com/a/18193383 ) and therefore we should check before trying to call fopen on a directory because I can't think of any use case for having a stream interface for a directory. Therefore @Night-walker calls it an invalid stream.

It's definitely to be corrected in modules/stream/dao_stream.c.

We're also trying hard to keep the Dao core as minimal as possible. If not absolutely necessary, we don't add such checks into the core, but rather to the user inputs (e.g. inputs from a programmer, which is the source code he's writing).

@daokoder your point of view?

@kunal
Copy link

kunal commented Oct 11, 2018

Thanks, @dumblob for the response. Yes by the platform I meant core. Yes, I will work on fixing this in the stream module.

@kunal
Copy link

kunal commented Oct 24, 2018

Any updates here? :)

@dumblob
Copy link

dumblob commented Oct 25, 2018

@kunal I think we shall maintain a separate git tree which will be used as "staging" (more or less according to this definition: https://lwn.net/Articles/324279/ ):

https://github.com/dumblob/dao

Could you just close your pull request to this repository and make the pull request to the staging repository?

@daokoder is being pretty busy during the last year or two and the project needs to get forward. @daokoder will of course stay as the main architect and maintainer of the project.

@kunal
Copy link

kunal commented Oct 29, 2018

@dumblob Will do. Thank you.

@dumblob
Copy link

dumblob commented Nov 19, 2018

@kunal could you post your pull request to the repository https://github.com/dumblob/dao ? I would be happy to merge it.

@kunal
Copy link

kunal commented Nov 23, 2018

@dumblob Yes I will. Have been busy with travels. Will try to do it asap.

@kunal
Copy link

kunal commented Nov 24, 2018

@dumblob I have sent pull request. Can you also create a staging area for dao-modules? :) I am working on modules as well.

@dumblob
Copy link

dumblob commented Nov 27, 2018

Have been busy with travels. Will try to do it asap.

No need to hurry - I just wanted to make sure it's alright from your point of view.

I have sent pull request.

I'll review it in the next days 😉.

Can you also create a staging area for dao-modules?

Done.

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

Successfully merging a pull request may close this issue.

3 participants