dao icon indicating copy to clipboard operation
dao copied to clipboard

io.open() may create invalid stream

Open Night-walker opened this issue 9 years ago • 10 comments

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

Night-walker avatar Mar 15 '16 16:03 Night-walker

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?

kunal avatar Oct 09 '18 12:10 kunal

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?

dumblob avatar Oct 10 '18 18:10 dumblob

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

kunal avatar Oct 11 '18 05:10 kunal

Any updates here? :)

kunal avatar Oct 24 '18 05:10 kunal

@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.

dumblob avatar Oct 25 '18 18:10 dumblob

@dumblob Will do. Thank you.

kunal avatar Oct 29 '18 06:10 kunal

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

dumblob avatar Nov 19 '18 18:11 dumblob

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

kunal avatar Nov 23 '18 23:11 kunal

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

kunal avatar Nov 24 '18 00:11 kunal

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 :wink:.

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

Done.

dumblob avatar Nov 27 '18 22:11 dumblob