[9fans] What about Haskell? [was: How can I use alef?]

2008-11-20 Thread Giacomo Tesio
I'm completely new to Functional Languages (actually I'm not understanding
whether they are useful in real world, or just to enance ones mind).

But I'm studing Haskell, and I saw that it was ported to Plan 9.

Without starting a flame war, I'd like to know if some of you think it could
be useful on a Plan 9 grid/environment.


Giacomo
PS: stream of consciousness was: limbo - erlang (which I took a look) -
haskell


On Thu, Nov 20, 2008 at 4:47 PM, Sergey Zhilkin [EMAIL PROTECTED] wrote:



 2008/11/19 Nolan Hamilton [EMAIL PROTECTED]

 Can people still use Alef?, if so how can I get my hands on it.


 People use Limbo.



Re: [9fans] web-based plan 9?

2008-11-20 Thread Giacomo Tesio

 cgifs: mostly done thanks to fgb. i'll put it up soon.
 rit: already available thanks to kenji
 filterfs: sythesize a filesystem from other fs and rc filters. could use
exportfs as a start. design in mind, no code yet.  at one
point ehg mentioned such a thing at Labs.
 sessionfs: keep continuity of http session for factotum.
design in mind, no code yet.
 httpd: modifications similar to pegasus to start httpd for an authenticated
user with that user's credentials. not done.

 with filterfs in place one can generate bits of js code along with
 html for the type of files being accessed, or views being looked
 at; but would still require a good bit more js code.



I'm really interessed in it.
I'm thinking about something similar (pegasus based) to build a web framewok
quite particular.

I'm in the study/design stage (and actually I dont master Plan 9 development
itself) but I'm sure that to be useful it must:

   - provide access to relational database towards a dedicated fs (with XML
   rappresentation of query results, but dont know yet about data manipulation
   and error handling)
   - provide a filesystem capable of transform an XML file with an XSLT
   template, so that dbfs and rest webservices could be handled the same way.
   - provide a filesystem able to transform a TAL (tag attribute language)
   template to XSLT, allowing graphic designer to directly transform the data
   provided by programmers in XML without knowing XSLT (just tal and eventually
   xpath)
   - implement url rewrite (if missing)
   - glue all together with a set of filesystem/applications able to handle
   the business logic (for example a simpe ecommerce would have a cataloguefs
   and a shoppingcartfs) rapidly written towards a dedicated library (may be
   something like your cgifs?)
   - provide a sessionfs able to mount (unmount would be necessary? I
   think so...) the correct filesystems/applications for each visitor.

I'd really like to take a look to your code / design (time permitting...
I've got a daughter... monopolizing my wife... those are hard times... :-D)
to get inspired/build upon that.

I know about RIT, and I think that it could be good for filling/merging xml
templates, but not as a template language itself...
As the smarty template engine shown to php programmers, even easy
programming language has to be put outside the presentation layer.


Actually I have to study factotum more since I could not understand how you
want to use it in a web environment.


Giacomo

Giacomo


Re: [9fans] web-based plan 9?

2008-11-21 Thread Giacomo Tesio
First of all... Thanks for your reply!

I hope we could continue this brainstorm... it was really useful for me.

On Fri, Nov 21, 2008 at 12:18 AM, Skip Tavakkolian [EMAIL PROTECTED] wrote:

 - provide access to relational database towards a dedicated fs (with
 XML
 rappresentation of query results, but dont know yet about data
 manipulation
 and error handling)

 an rdbms interface will be messy; maybe just try to get a ODBC client
 library.  most of the time what is really needed is fast lookup;
 something like PQ would do.  a lot of places use DB to store things
 that naturally belong in a file heirarchy.


May be. But there are also (many? here where I work it's so!) place where
datas (and their relations) MUST be kept consistents.
And MUST be updated frequently, in transaction.
Application code cannot do that, since it's too subject to modifications
(and this for complex applications lead to inevitable bugs which must not
corrupt datas).

Moreover such a dbfs should allow rapid development of views over data (with
different permissions) by simply write the query in a file and then open the
file for reading the XML.


 - provide a filesystem capable of transform an XML file with an XSLT
 template, so that dbfs and rest webservices could be handled the same
 way.

 i see these as filters used by filterfs.  the filter to file mapping
 might be doable using plumber.


Right... the could be seen so (but what about caching results?).
plumber is still black magic for me... dirty lunix user... :-D



 - glue all together with a set of filesystem/applications able to
 handle
 the business logic (for example a simpe ecommerce would have a
 cataloguefs
 and a shoppingcartfs) rapidly written towards a dedicated library (may
 be
 something like your cgifs?)

 it's easy to develop libraries for cgifs.  it's all in rc.  if you
 need something special, write a C utility that does the
 specific thing.


Good! ! !

The example you provided show exactly what I need to know about cgifs.

But not exactly what I think, since as I could understand, cgifs
applications dont keep state during the user session.

I mean that, in the simple ecommerce example, the shoppingcartfs is an
application than handle the shopping cart for each particular session, and
it's started (= mounted) when a new client connect and closed when the
session timeout.

From a OO prespective each such filesystem are Objects handling Models.
Writing to shoppingcartfs/add something like AB123123|20 would add a 20 item
with code AB123123, updating the totals.
Then by reading shoppingcartfs/status, you would get all the info you need
(in XML) in the next requests from that client.

Note that those XML could be handled locally by the server (building HTML
for the client) or sent to the client as it is, if _that_ client support
ajax and xslt transformations, moving part of the computation there.

If Javascript was disabled (suppose for blind's software reading the page),
all will work.



 - provide a sessionfs able to mount (unmount would be necessary? I
 think so...) the correct filesystems/applications for each visitor.

 srvfs posted to /srv will do; a httpd running with the proper
 permissions wont have a problem mounting what's posted in /srv.  what
 i have in mind for sessionfs is to keep a stateless http session
 (using session id's that are consecutive and time sensitive) to carry
 a conversation with factotum.


:-o

Could you repeat in Klingon, please? :-D

Ok... I have to study (quite) a bit more... :-D


My (from 1 foot) idea of a sessionfs is to enable the httpd to send all
the request coming from a given client to some particular temporary dir
where all the application/filesystems are mounted for that particular client
session.

This way once mounted, the applications/fs/objects (as you like so see them)
are absolutely stateful, even if the protocol is stateless.

Factotum and /srv/ could do this?



 fyi, here's the rc version of 'save' that uses cgifs:


Wondefully simple. The only issue is the programmer have to handle directly
the protocol (as in any CGI).
I'd like to abstract a little more.


Thank you a lot if you read till here! :-D


Giacomo


Re: [9fans] web-based plan 9?

2008-11-21 Thread Giacomo Tesio
 I ended up just adding the PGmodule to the app instead.


You used libpq to write such a PGmodule?
I worked with PostgreSQL for 6 year... I find it wonderfull, and I would use
it as the db backend for any opensource application I would write.



 I realise that exporting and mounting would be facilitated by the FS layer
 but I didn't have any reason to exploit such availablility.

 Basically I got as far as saying to myself - this will buy me nothing more
 than I have already so I'll just stop, one fo these days I might do the FS
 side of it, maybe.


I'd like to know how do you would map the operations to the filesystem.

Query result in a filesystem hierachy would be a pain... xml would be
better, since you could transform it quickly.
BTW, there should be an xmlfs project waiting somewhere...


Giacomo


Re: [9fans] web-based plan 9?

2008-11-21 Thread Giacomo Tesio

 I'd like to know how do you would map the operations to the filesystem.


 one directory per queryset row returned (possibly named by the primary
 key), one file per column


Ok... I read it somewhere in the archives of the list.

But I found it a little inadeguate:
- what about multiple fields primary key?
- what about transactions?
- what data modifications (insert update delete)?

'till now I imagine it so:
opening a transaction could be creating a directory on a dbfs/transactions/
each of such directories (like the complete connection) has

   - a ctrl file which accept only COMMIT, ROLLBACK and ABORT
   - an error file
   - a notice file (postgresql has RAISE NOTICE... may be others have it
   too)
   - a data file (append only in the transaction, but not outside) where
   the INSERT, UPDATES, DELETE and all the DDL and DCL commands will be written
   - each SELECT have to be written in a different file (named
   sequentially): after writing the query, the same file could be read to get
   the results (in xml...)
   - on errors, sequents writes fails and error file will be readable





  Query result in a filesystem hierachy would be a pain... xml would be
 better, since you could transform it quickly.
 BTW, there should be an xmlfs project waiting somewhere...


 ah xml, the ultimate 2d grid !


I'm missing what you mean.

xlmfs is bugged?


Giacomo


Re: [9fans] web-based plan 9?

2008-11-22 Thread Giacomo Tesio
On 11/21/08, erik quanstrom [EMAIL PROTECTED] wrote:
 databases seem pretty far outside 9fans territory and design
 on a mailing list doesn't seem like a good idea  ...

Excuse me... BTW, is there a mailing list to discuss such design problems?
I could not be consider a Plan 9 user, yet, I've just studied it for a while.
Proposing such a framework was a way to check my understanding, too.

 since a relational database isn't imperative thing, i have never
 understood having a imperative interface to one, especially an
 unconstrained interface.  if you have a problem big enough to
 warrant a database, it will get refactored, rekeyed, renormaled c.

Still data conteined will be consistent.

I would have a lot of work to do, but who would pay for my time would
not loose it's informations. They will be differently organized,
differetly used... ok.

But the problem, the new feature requested, is what HE need.

(and, in the last 3 years, I've never got such a destructing
refactoring in any of the database I designed - and they were not
blog/toy db ;-D )

 ..it needs be a big boy and take care of itself.

There are product/project where many different professions are needed.

Even if I'm often a glue among different fields, no one could do
everything alone.

Different tiers allow different men to work together.
That's why we use db. Moreover if a man commit an error, db
constraints keep data safe. And who pay me could accept a bug in the
software if his data (suppose the contability of a bank) are kept ok.

  would you put up with a file system
 that required you to do the locking and inode allocation yourself?

Why? The question is not clear to me...


 - erik


Giacomo



[9fans] dbfs and web framework for plan 9 (was: web-based plan 9?)

2008-11-23 Thread Giacomo Tesio
Since I know it was discussed in the past (but I could not find the post in
the archives) I hope to be original by not reiterate old ideas.

BTW I start from a reply to a previous post to explain what I would need to
use plan 9 for web development.

But first of all, I have to say that I'm not (yet) a Plan 9 user/developer,
just a programmer who studied it and loved its potentialities.


Actually I'm thinking about how to use Plan 9 in web development (real one,
I'm not talking about having a blog or a shinny flash site), and I'm
proposing a structure for data access towards a dbfs interface.

The scope is to be able to query the db towards a filesystem, with no need
to use different libraries for different db backend... each application
would use a filesystem, while each rdbms would have it's own filesystem (all
with the same structure, obviously)


Now the WHY I think such an interface matter:

On Fri, Nov 21, 2008 at 7:12 PM, [EMAIL PROTECTED] wrote:

 On db ↔ fs conversions:
 // datas (and their relations) MUST be kept consistents.

 there's two things you could mean here: either the
 relations between the data fields/types or the relations
 between their values.



Both are really important.

When a product change its code (aka pk) for business' reasons, I need have
it changed automatically in any place its referred in the database.
Or if a dumb employee try to delete a product category (supposing he's
allowed) I have to be sure that the remaining data don't loose meaning.


SQL databases are interesting because they don't do anything to keep the
 relations
 consistent, at a schema level.


They do, if you instruct them about the relations amont your tables.
(MS Access don't count as a db :-D)



 there are some cases where
 this is valuable, but most of the time it just puts more of
 the burden on the application.


Application should HANDLE data.
But datas are a rapresentation of a reality which have a meaning!
A relational database don't have to know how datas are collected or used.
But it has to keep meaningfull the rappresentation.



 enforcing consistency between values is a whole different
 matter.


Obviously I'll check user provided data types before sending them to the db.
BTW, db also have to, for different reasons.
I've to protect my database from malicious sql injections, it has to protect
datas from inconsistency (say a string in a date field).

and largely needs to be done in the ap anyway (say
 your DB rejects a submission; are you just giong to panic,
 say try again, or try and figure out what it didn't like?).


Well, accoding to the needs, different strategies are followed.
Sometime the error will go (human translated :-D) to the user, others a
signalation will go to the developers.

Here is a disadvantage: user provided data are double checked (some time
checks are 3, when also a remote client do the check, say via javascript).
I reflected a lot about this, but (still) found no solution.

I just notice that the reasons for the checks are different:
1. DB check to keep data consistents
2. Application check to validate data against malicious ones
3. (eventually) browsers check to help the user and to save a little of band

If you need data consistency (anyone need I think) DB have to check.
If you can't trust the user application have to check.
If you don't have enouth Gbits you could also need to repeat the data check
in the browser.



 // And MUST be updated frequently, in transaction.

 just curious: what is it about transactionality that you care
 about? atomicity, logging, roll-back (atomic roll-back)?


Atomicity and rollback. (logging is useful too...)

I need to be able to atomically save related tuples in different tables,
since (for example) those different tables could be simply modelling ONE
real entity (say an order or a family).

// Application code cannot do that, since it's too subject to
 // modifications...

 i'm not convinced. you can simply... not modify it!


You are right... I like my applications... (almost all...)
I really don't want... but they paid me! :-D


 unless you've got a database you're exposing to multiple parties
 and you're worried one is going to mess things up for
 others, but in that case i think exposing the database
 directly is pretty risky regardless.


There why we use REST... but that's another history...


 the application i've worked on with the most complex data
 constraints had an ontology layer that everything that
 wanted to do data access went through.


'till now our ontology layer was the database itself.

But I would be curious about how this ontology layer was implemented.
Really!


 // Moreover such a dbfs should allow rapid development of
 // views over data (with different permissions) by simply
 // write the query in a file and then open the file for reading
 // the XML.

 somewhere around here i've got a /chan/pq for inferno that
 makes connections to a pq database. each open is a new
 logical connection; you write the 

Re: [9fans] dbfs and web framework for plan 9 (was: web-based plan 9?)

2008-11-24 Thread Giacomo Tesio
On Sun, Nov 23, 2008 at 11:06 PM, Enrico Weigelt [EMAIL PROTECTED] wrote:

 * Giacomo Tesio [EMAIL PROTECTED] wrote:

 Hi,


Hi! Thanks for your reply.

A premise: I'm not talking about developing a web forum or the like.

I'm talking about a framework to develop large applications with thin
clients (as many call the browsers... :-D) which have more complex
requirement than a web forum.

Forums, I think, don't need a database... (even if a database _could_
increase developers productivity)


  The scope is to be able to query the db towards a filesystem, with no
 need
  to use different libraries for different db backend... each application
  would use a filesystem, while each rdbms would have it's own filesystem
 (all
  with the same structure, obviously)


 That's a really good idea. But there's still one problem to solve:
 filesystem hierachies and relational algebra are fundamentally
 different concepts. So, if you don't want to just the fs as some
 universal sql-transport, data has to be modeled differently.


Well... to keep things simples, yes...
I thinks there's no need to reinvent the wheel, since SQL is so diffused.

And, thinking a bit more, I'm wondering whether v9fs could help to build
such a filesystem on linux (where PostgreSQL run) and expose it to plan 9
clients
(actually I don't know what v9fs is and how it works... it would be easy
to develop a fuse synthetic filesystem for this, but exporting with v9fs it
would introduce an unnecessary layer, so build directly in v9fs would be
better, if possible).

I'm thinking about a (new) real world application of plan 9.
In the real world I know, men's productivity is really important (80% of
the costs)
Without insult for anyone, I don't want to get a new toy for university
research... (even I would be glad to work with students on it), I want
something which could improve seriously the productivity of a real team
(with eterogeneous skills) on reals web applications development.

A forum or a web calendar is not (per se) such a real application.
With all the forums out there, it would be more a didactical hack.




 Actually, in many webapps, the real underlying models are neither
 relational nor hierachic, but most times just happen to be
 modelled relatiolally, because rdmbs'es are the tool of choice
 for most people.


Aren't they?


 So what we have to do here is to get back to the original problems
 to solve and think about how they could fit into an hierachy
 instead of relation.
 ...
 Okay, we've got some more data, eg. profile information, maybe all
 the other web-2.0 stuff (user galleries, friend relations, etc),
 but IMHO this all easily fits in hierachies if we start thinking
 afresh with a blank paper.
 ...
 That's all possible, if we just can imagine it :)


You're right, and I'm sure it would be a wonderful research.

Actually I've also thinked about such a solution (well... more or less) and
came to BerkleyDB XML.

Take a look to it. It could be a good source of ideas.



 Simple example: a web-forum.



Too simple. In previous post I talked about an ecommerce, and yet I was
thinking it was a too simple example.

BTW, if you miss a post on a forum, you would be hungry.
But what if you pay for and order without receving the product you paid for?



  Both are really important.
 
  When a product change its code (aka pk) for business' reasons, I need
 have
  it changed automatically in any place its referred in the database.
  Or if a dumb employee try to delete a product category (supposing he's
  allowed) I have to be sure that the remaining data don't loose meaning.


 That's exactly what constraints, rules in SQL etc are for.
 Maybe some similar ruling system for filesystems would be fine :)
 (any suggestions ?)


Mmm.. I'm not sure.

Too complex, for a _file_system.




  Application should HANDLE data.
  But datas are a rapresentation of a reality which have a meaning!
  A relational database don't have to know how datas are collected or used.
  But it has to keep meaningfull the rappresentation.

 Right. But the database has to know rules which data has to comply,
 so a wide range of errors becomes impossible, mathematically provable.


Sure. It was what I was tring to say... sorry for my english! :-D

This is WHY relational database are needed: to be istructed to check for
data integrity/consistency.



  I need to be able to atomically save related tuples in different tables,
  since (for example) those different tables could be simply modelling ONE
  real entity (say an order or a family).

 CREATE RULE .. AS ON INSERT TO ...


 Again, a rule system for filesystems would be really cool :)


I think that rule (or triggers) on any filesystem would be too complex.

You would loose the simplicity of the paradigm.

But I must admit that omero (completely offtopic here) make me think a bit
about such a thing: what if we could add to each element interface/file
events in the form of rc scripts?

Say you have a button

Re: [9fans] dbfs and web framework for plan 9 (was: web-based plan 9?)

2008-11-24 Thread Giacomo Tesio

 BTW, if you miss a post on a forum, you would be *hungry*.


LOOL! ! ! I was meaning... angry... :-D


Re: [9fans] dbfs and web framework for plan 9

2008-11-24 Thread Giacomo Tesio
On Mon, Nov 24, 2008 at 11:58 AM, matt [EMAIL PROTECTED] wrote:


  That's exactly what constraints, rules in SQL etc are for. Maybe some
 similar ruling system for filesystems would be fine :)
 (any suggestions ?)


 That's what I was driving at. To map SQL  FS you end up replicating lots
 of SQL logic in your client FS. Reads are *always* out of date. Writes can
 happen across tables but need to be atomic and able to roll back.


Probably I was not clear on what I'm thinking about.

I think that rebuild a relational database on a filesystem is (quite)
pointless.


What I'm proposing is to design/develop the interface to interact with
(any?) rdbms through a filesystem.

A kind of proxy to the db with a filesystem interface.

A draft could be (even if I've already found some problems in it):


- a ctrl file which accept only COMMIT, ROLLBACK and ABORT
- an error file
- a notice file (postgresql has RAISE NOTICE... may be others have it
too)
- a data file (append only in the transaction, but not outside) where
the INSERT, UPDATES, DELETE and all the DDL and DCL commands will be 
 written
- each SELECT have to be written in a different file (named
sequentially): after writing the query, the same file could be read to get
the results (in xml...)
- on errors, sequents writes fails and error file will be readable

 The problems:

   - transaction - directory conversion require creating a new connection
   to the backend (if I'm right thinking that transaction are connection wide)
   - xml output of fetchable results (SELECT, FETCH, SHOW...) require a tool
   to easily query such an output. It seem Plan 9 miss such a tool. xmlfs
   actually is unsuitable.
   (I'm thinking about an xpath command accepting xml in stdin and the xpath
   query as an argument, and return to stdout the results)


Giacomo


[9fans] xml2 and APE

2008-11-25 Thread Giacomo Tesio
Hello list,

I've found in http://netlib.bell-labs.com/wiki/plan9/Contrib_index/ the xml2
(libxml2-2.6.30 for APE) package from Federico G. Benavento.

I was wondering if I have to use all the APE to use the library for writing
a Plan 9 application.


Giacomo


[9fans] libixp

2008-11-25 Thread Giacomo Tesio
Anyone know if with such a library I could write an application on linux
mountable from Plan 9?

I've understood it could be used for syntetic fs accessible from the local
machine (as for wmii), but what about accessing such filesystem from
outside?


Giacomo


Re: [9fans] xml2 and APE

2008-11-25 Thread Giacomo Tesio
Ehm... Sorry... :-D

As I knew libxml2, I directly searched libxml2 in the contrib page...


You're right... I'll use that. :-D


Giacomo

On Tue, Nov 25, 2008 at 9:40 PM, Federico G. Benavento
[EMAIL PROTECTED]wrote:

 hola,

  I was wondering if I have to use all the APE to use the library for
 writing
  a Plan 9 application.

 as it says it's an APE port, that means you have to use the APE api with
 it,
 I see no point in writing a native app using libxml2, if I needed to doing
 some
  xml I'd use something like steve's libxml

 /n/sources/contrib/steve/libxml.tar






 --
 Federico G. Benavento




Re: [9fans] xml2 and APE

2008-11-25 Thread Giacomo Tesio
I'd prefer to avoid flame war, since I know this is an hot cold topic here.

But I don't agree.

On Tue, Nov 25, 2008 at 11:34 PM, Uriel [EMAIL PROTECTED] wrote:

 xml? Just say *no*.

 And BTW, steve's libxml is far from usable and doesn't really
 implement the complete standard (but who can blame him? the libxml2
 people have been working on their implementation for years, and it is
 still full of bugs and security issues, not to mention insanely slow).


well... slow... may be  if compared with a parser for a non-extensible
language, but I'm not sure I could do better (even if I didn't try).

As any other tecnology XML could be misused. But there is no reason to
hate it so much.

Depending on your application design and the (human or not) environment who
required the application, it could be a bless or a mess.


For what I'm thinking there is simply no other way to obtain the result.

I need to encapsulate human skills to minimize the interaction between them
(graphic designers and developers).
With the (huge?) fixed cost of such a library development, I could minimize
it.

Again, just say *no* to xml, even the web 2.0 fools have given it up.


I find many approaching XML in a similar way than other use for plan 9: they
are so misunderstood!

Those web 2.0 guys who decided to avoid XML are often moving HTML pieces.
And they fill them selves smart. Or evalutating JSON.

It could seem smart, actually. But when client change (say from a browser to
a flash or to a web service) your problem begins.

Moreover those smart guys mix data and presentation.
They are smart if their only need is to sell a web 2.0 site to someone
actually need a blog.
For anything more, they are chosing a dangerous road.



 uriel


Giacomo
PS: I've had way to appretiate your estetical opinions about software
design. Only upon this subject I deeply disagree with you.


Re: [9fans] xml2 and APE

2008-11-26 Thread Giacomo Tesio
Probably my english is worse than I thought! :-D

Well. I'd like to build a framework for web development as described in
http://9fans.net/archive/2008/11/748
http://9fans.net/archive/2008/11/796

Since XML (and XSLT) are so diffused, it would allow to delegate the (not
so) tiny client/browser to dressup data toward javascript and to optimize
bandwith by moving only needed contents.

Obviously, when the client is really tiny, like the blind readers are, or
doesn't support javascript, the server has to be able to translate by itself
and send it yet dressed webpages.

Well this is one of the feature I require.

But, in 5 years of (non exclusive) web development, I could not find such a
framework.


IMHO, it would be also a chance for Plan 9 itself to be a bit less
elitarian.
More complex and huge systems (like JEE or .NET) don't allow the role
separation (developer / graphic designer) I aim to. Nor the speed, the
security or the scalability.


Sadly, 'till now, they are just ideas.


Giacomo


On Wed, Nov 26, 2008 at 3:01 AM, Nick LaForge [EMAIL PROTECTED] wrote:

 hello,

 interfacing external languages should not often be hard, especially by
 defining a relevent language subset.

 i don't understand, though, why your external language 'xml' need now
 be part of your application?

 thanks,
 nkl




[9fans] FileServer grid

2009-02-06 Thread Giacomo Tesio
Hello every one...
In a context of really heavy load and high availability needs, I'm
evaluating plan 9 to implement a fileserver grid to be used by a web server
for temporary storage (session's serializations, for example).

I'd like to build a Plan 9 grid exposing a unique filesystem mounted by all
the web servers.

Each session could be accessible from any web server instantly, but what if
a fileserver in the grid break?
Is there a way to mantain such a session (actually the file storing the
session data) available by keeping it sincronized beetween the Plan 9
fileservers?


Hoping to have been clear...
Thanks for your help


Giacomo


Re: [9fans] FileServer grid

2009-02-07 Thread Giacomo Tesio
I'd like to move our softwares to Linux + Apache (where mounting a 9p
fileserver would be easy), but actually it's a Windows + IIS.

I would write a session state service for ASP.NET connecting it in 9p (using
c# and the 9pc implementation linked by http://9p.cat-v.org/implementations...
actually the link is broken...)

If the filesystem grid work as I've understood, there would be only ONE
filesystem.

So, saving session state in the grid would make it available to all web
servers connected to the filesystem, allowing load balance and high
availability for the web servers (when one crash, the user sessions it was
handling would be available to the others web server).

But what if a node of the grid goes down? There would be a way to keep files
in it replicated in other cpu node?


Giacomo

On Fri, Feb 6, 2009 at 11:41 PM, Roman V. Shaposhnik r...@sun.com wrote:

 On Fri, 2009-02-06 at 23:26 +0100, Giacomo Tesio wrote:
  Hello every one...
  In a context of really heavy load and high availability needs, I'm
  evaluating plan 9 to implement a fileserver grid to be used by a web
  server for temporary storage (session's serializations, for example).

 What OS do you web servers run under?

  I'd like to build a Plan 9 grid exposing a unique filesystem mounted
  by all the web servers.

 Are you going to talk to this filesystem using 9P or something else?

  Each session could be accessible from any web server instantly, but
  what if a fileserver in the grid break?
  Is there a way to mantain such a session (actually the file storing
  the session data) available by keeping it sincronized beetween the
  Plan 9 fileservers?

 This is unclear. Please restate.

 Thanks,
 Roman.





Re: [9fans] FileServer grid

2009-02-08 Thread Giacomo Tesio
Sorry Uriel... I was meaning that I wouldn't be able to download it.


BTW my main problem is to know if, in a grid of plan 9 fileservers, there
could be any kind of replication, keeping files reachable when a node goes
down.


Giacomo

On Sat, Feb 7, 2009 at 11:57 PM, Uriel urie...@gmail.com wrote:

 The link is *not* broken, plan9.bell-labs.com is, sadly and
 unsurprisingly, broken.

 uriel

 On Sat, Feb 7, 2009 at 6:32 PM, Giacomo Tesio giac...@tesio.it wrote:
  I'd like to move our softwares to Linux + Apache (where mounting a 9p
  fileserver would be easy), but actually it's a Windows + IIS.
 
  I would write a session state service for ASP.NET connecting it in 9p
 (using
  c# and the 9pc implementation linked by
  http://9p.cat-v.org/implementations... actually the link is broken...)
 
  If the filesystem grid work as I've understood, there would be only ONE
  filesystem.
 
  So, saving session state in the grid would make it available to all web
  servers connected to the filesystem, allowing load balance and high
  availability for the web servers (when one crash, the user sessions it
 was
  handling would be available to the others web server).
 
  But what if a node of the grid goes down? There would be a way to keep
 files
  in it replicated in other cpu node?
 
 
  Giacomo
 
  On Fri, Feb 6, 2009 at 11:41 PM, Roman V. Shaposhnik r...@sun.com
 wrote:
 
  On Fri, 2009-02-06 at 23:26 +0100, Giacomo Tesio wrote:
   Hello every one...
   In a context of really heavy load and high availability needs, I'm
   evaluating plan 9 to implement a fileserver grid to be used by a web
   server for temporary storage (session's serializations, for example).
 
  What OS do you web servers run under?
 
   I'd like to build a Plan 9 grid exposing a unique filesystem mounted
   by all the web servers.
 
  Are you going to talk to this filesystem using 9P or something else?
 
   Each session could be accessible from any web server instantly, but
   what if a fileserver in the grid break?
   Is there a way to mantain such a session (actually the file storing
   the session data) available by keeping it sincronized beetween the
   Plan 9 fileservers?
 
  This is unclear. Please restate.
 
  Thanks,
  Roman.
 
 
 
 




Re: [9fans] FileServer grid

2009-02-09 Thread Giacomo Tesio

 Have you done a literature search? I don't get the feeling that you have.



You are right, I searched over the net only about Plan 9 filesystem
replication and so...


But I was always searching for a plan 9 based solution.

I already have some alternative solution (linux based), but I would like to
use plan 9 in a prodution environment (to emancipate it to my collegue
eyes...)



 Thanks

 ron


Thanks you too!

I will get a look to your suggestions!


Giacomo


Re: [9fans] FileServer grid

2009-02-10 Thread Giacomo Tesio

 So far it seems that there are no ready-made 9P-based solutions available
 for what
 you have in mind. At least I don't know of any.


In any solution available there are costs to pay (economical or temporary
ones).

So I could write the code missinig, if the time required to write the
filesystem sincronization and the session state handler would be a month.

For more than a month the economical cost would be (more or less) equal to
the prebuild solutions in the market.

For writing the session state handler over 9P I estimate a week...
If a sincronization system for the grid nodes (or a sintetic filesystem
providing access to the grid and replicating writes among node) would
require more than 3 weeks of man work probably I've no chance to get this
solution approved.



 Thanks,
 Roman.



Thanks you!

Giacomo


Re: [9fans] FileServer grid

2009-02-10 Thread Giacomo Tesio
is it too much for a syntetic filesystem 9P based? or too few?



On Tue, Feb 10, 2009 at 5:37 PM, ron minnich rminn...@gmail.com wrote:

 On Tue, Feb 10, 2009 at 12:06 AM, Giacomo Tesio giac...@tesio.it wrote:

  If a sincronization system for the grid nodes (or a sintetic filesystem
  providing access to the grid and replicating writes among node) would
  require more than 3 weeks of man work probably I've no chance to get this
  solution approved.

 3 weeks? I think you have a problem here. Stop now.

 This is a non trivial problem. At least from what I know.

 ron




[9fans] Plan 9 on Microsoft Virtual PC

2010-01-29 Thread Giacomo Tesio
Hello 9fans!

I've tried to install Plan 9 on a 64 bit Windows 7 using Virtual PC, since
I've read that a related bug was fixed and noone tried it.

Actually, after the fourth tentative (after creating a fossil partition a
bit smaller than the fixed size hd) I got rc starting by logging with the
glenda user.

BUT, after the rio start I got the attached error.


I'll use QEMU as I read it should work, but I hope this feedback could help.



Giacomo
attachment: plan9-vpc.gif

Re: [9fans] Plan 9 on Microsoft Virtual PC

2010-01-29 Thread Giacomo Tesio
I've tried again and it worked by using a dynamically sized hd of 3 GB ad
using a 2 GB fossil partition starting at cylinder 1

Don't ask me why it worked for a while (some minutes) and than crashed with
similar messages.

I suppose I've done it right, but I'm not sure.
A similar procedure worked on QEMU, but it's by far slower.


If you managed to get a Plan9 working Microsoft Virtual PC please tell me
the procedure you used, the hd settings, the partitions and how you
configured the mbr...

Thanks a lot!


Giacomo



On Fri, Jan 29, 2010 at 4:46 PM, Patrick Kelly kameo76...@gmail.com wrote:


 On Jan 29, 2010, at 6:44 AM, Giacomo Tesio wrote:

  Hello 9fans!

 I've tried to install Plan 9 on a 64 bit Windows 7 using Virtual PC, since
 I've read that a related bug was fixed and noone tried it.

 I just announced it worked like 2 weeks ago.


 Actually, after the fourth tentative (after creating a fossil partition a
 bit smaller than the fixed size hd) I got rc starting by logging with the
 glenda user.

 BUT, after the rio start I got the attached error.

 I never had any problems starting up Plan 9 with rio, heck I never had any
 trouble at all. You sure you have everything set up right on your end?



 I'll use QEMU as I read it should work, but I hope this feedback could
 help.



 Giacomo
 plan9-vpc.gif






Re: [9fans] Returning to Plan 9: Virtualization, Distributions

2011-11-22 Thread Giacomo Tesio
Please, (b)log the path: I'd like to play again with plan9... but I
completely forgot how I had configured qemu-kvm (and I remember that I had
had some trouble with the network on my debian)... :-(


Giacomo

On Tue, Nov 22, 2011 at 11:50 PM, Joel C. Salomon joelcsalo...@gmail.comwrote:

  On 11/22/2011 9:39 AM, Joel C. Salomon wrote:
  After a long hiatus, I'd like to get back to experimenting with Plan
  9.  I have an Ubuntu Linux laptop with AMD's virtualization extensions
  supported by the CPU, so I figure my best bet is one of the umpteen
  virtualization tools.  Which is best supported by Plan 9 — virtualbox,
  qemu, or something else?

 On 11/22/2011 02:41 PM, Jack Norton wrote:
  I have had good luck with qemu-kvm.  I've even got a VPS running with
  all the management bells and wistles like libvirt and such.  It has been
  running solid since march (lab's plan9 with fossil only).

 On 11/22/2011 05:14 PM, John Floren wrote:
  I found that Virtualbox worked very well when I was fiddling with my
  Macbook on the way back from IWP9. I haven't tried it on the thinkpad
  yet.

 Thanks; I'll try them in turn, see if I get one to work.

 —Joel




Re: [9fans] wstat and atomic directory change

2015-02-04 Thread Giacomo Tesio
2015-02-04 4:51 GMT+01:00 erik quanstrom quans...@quanstro.net:

 On Tue Feb  3 01:01:02 PST 2015, st...@quintile.net wrote:

  the control file idea is a neat way of doing atomic moves.
 

 control files are a good way of dealing with all kinds of exceptional
 behavior.

 but ...

 to be fair, this goes against the unix ideal of having uniform file
 operations.


You are right.
But since protocol customizations goes against that same ideal, what's the
plan9 way of dealing with a feature X (in this specific case atomic file
moves)?


 this requires delving into the namespace to tell that the directories are
 still under the
 same mount, and some non-uniform operations.


Good point. But thus, what are the alternatives?


Giacomo


Re: [9fans] wstat and atomic directory change

2015-02-04 Thread Giacomo Tesio
Useless? No I did not mean this.
(and sorry, I wasn't in any way sarcastic, I'm just trying to understand
9p's design a bit deeper)
I mean that to realize a truly uniform interface, directories should be
writable with Twrite, so that we would not need messages like Tcreate and
Tremove (and possibly Twstat) and Tstat would just be an efficient shortcut
(like it actually already is, since we can obtain the same info reading the
parent directory).

We could add a file by appending a stat entry to the parent directory and
we could remove it by removing such entry. We could modify permissions,
names and so on overwriting the entry.
The problem would be: how to do such basic operations atomically and
concurrently?

That's why (I suppose) we have Tcreate, Tremove and Twstat. For praticality.
But why we don't have Tmove for example?

Probably the answer is in the distributed nature of Plan 9: as you said,
namespaces would be at odds with such a message, complicating the library
functions.
However having to read and write a 10 GB file one msize after the other
just to change its directory looks a bit costly, if both the origin and the
destinations are in the same phisical disk.
Moreover (if I've understood properly the protocol) to move a 10 GB file
between two directories on a disk, you should have 10 GB free on that disk!

All this reflections arise from the search for an orthodox way to change
the tree structure of a synthetic filesystem.
Moving large real files is not my actual issue here. I'm wondering for a
synthetic filesystem in which, when you move a folder in a special
directory, something magic happens.
As far as I can see, it is not possible with a 9p2000 fileservice, is it?


Giacomo


2015-02-04 20:23 GMT+01:00 erik quanstrom quans...@quanstro.net:

  you can consider doing it out of band; e.g. a new fossil console command.
  On Wed, Feb 4, 2015 at 6:30 AM Giacomo Tesio giac...@tesio.it wrote:
 
   And unfortunately I cannot figure out any alternative, either. :-(
  
   An interesting point is: why directory entries can be read but cannot
 be
   written? I mean we use Tcreate to create a new file in a dir, while to
 be
   uniform with files, we should use a Twrite, appending a corresponding
 stat
   structure at the end of a directory entry.
  
   However this solution probably has not been adopted to enable safe
   concurrency in the file creation and removal.
  
   However this asymmetry shows that directories cannot be (pratically)
   handled in the same way of files.

 right.  directories are not the same as files.  you're right that reading a
 directory is useless.

 - erik




Re: [9fans] wstat and atomic directory change

2015-02-05 Thread Giacomo Tesio
2015-02-05 5:26 GMT+01:00 s...@9front.org:

  But why we don't have Tmove for example?

 http://9front.org/img/tmove.jpg


ROFTL! :-D


Re: [9fans] wstat and atomic directory change

2015-02-05 Thread Giacomo Tesio
2015-02-05 5:13 GMT+01:00 lu...@proxima.alt.za:

  But why we don't have Tmove for example?

 Because its semantics are much, much more complex and the users need
 to be aware of the difference.

This shouldn't be so hard to obtain.

I mean we could simply introduce a new command rename oldpath
newpath that only works when both path share the same mount point.
This way the mv commands would keep the old safe semantic, while the
new command would protect the user to accidentally disclosure his data
to the world via the cloud.

  Imagine a Tmove that transfers your
 entire disk contents to the cloud: would you like it to be perceived
 as trivial?  What happens if you interrupt it?  Worse, what happens if
 you can't interrupt it?

I won't be drammatic: you can always unplug the enthernet! :-D

Btw, I see the point.


Giacomo



Re: [9fans] wstat and atomic directory change

2015-01-30 Thread Giacomo Tesio
It surely would not be conformant to Plan 9 systems, but to the protocol?

As far as I can read intro(5), it explicitly excludes slash as a valid
character for the Plan 9 OS, but it also explicitly states that the
protocol has no such restriction.

Be patient: I'm asking because this could be a typo in the intro(5) man
page, or in my understanding of its phrasing.

Still, using this protocol feature to enable atomic directory change
could be useful in my use cases, but I don't want to build yet another
9p2000 extension.


Giacomo


2015-01-30 15:13 GMT+01:00 erik quanstrom quans...@quanstro.net:

  Now, since the protocol does not restrict names (even if Plan 9 does it),
  I'm wondering if setting the name to a full path starting from root could
  be used to change atomically the directory of a file (given the write
  permission on both original and target directory).
 
  Obviously I'm not referring to Plan 9 file servers (I guess this would
 be a
  non retrocompatbile change), but I'm considering if such interpretation
  would be wrong (according to the official specifications).
 
  A server supporting such behaviour could be considered a 9p2000
 conformant
  server?

 it would not be conformant.  the intro explicitly excludes slash as a
 valid character.
 (unlike a dns zone.)  and its more detailed explinations are meant to hold
 for the
 entire section.

 but you could still do it, as long as the file servers were the same.

 - erik




Re: [9fans] wstat and atomic directory change

2015-02-03 Thread Giacomo Tesio
Ok, got it.

This annoing thread (sorry) was due to the fact that the only messages that
actually contains the / marker are Tauth and Tattach (in the aname). I
still think that using wstat with such marker to atomically move files
among accessible folders would not violate the protocol specification, but
actually it would break existing servers and that's is probably enough to
define it as an extension to the protocol (say 9P2000.a) so that clients
can know if the server supports this semantic or not.
However, as I previously said, I don't think that the world need a new 9p
variant :-D

Now, what's the proper 9p way that a client could use to tell a syntetic
server to atomically move a syntetic file between syntetic folders?
I bet that the answer is a control file receiving rc like commands (or any
other custom, human readable protocol). Would it be correct?

Something like this:

Given
mountpoint/
+ first/
  + moveme.txt
+ second/
+ atomically

Doing
echo mv /first/moveme.txt /second/  mountpoint/atomically

We optain either the following or a Rerror:
mountpoint/
+ first/
+ second/
  + moveme.txt
+ atomically


Is it the proper way to achieve such kind of operations?


Thanks for your patience... :-)


Giacomo

2015-01-30 23:49 GMT+01:00 Anthony Sorace a...@9srv.net:


  On Jan 30, 2015, at 10:59 , Giacomo Tesio giac...@tesio.it wrote:
 
  It surely would not be conformant to Plan 9 systems, but to the protocol?

 No. Joel has it right. Writing a server which allows / in names would mean
 that the / you're slipping into a name wouldn't always be a directory
 indicator or name separator. Think of it as the protocol accommodating
 systems which use some other marker.

 The relevant point is that the name in question (which, as you noticed,
 the protocol allows to contain / even though plan9 doesn't) is the name
 *within a directory*, not a full path name. walk(5) probably gives the best
 explanation of this, or perhaps the discussion of create in open(5).





[9fans] 9p2000 agent supporting multiple clients on a single connection

2015-02-03 Thread Giacomo Tesio
While reading intro(5) I noticed these very interesting lines:

Fids are chosen by
the client.  All requests on a connection share the same fid
space; when several clients share a connection, the agent
managing the sharing must arrange that no two clients choose
the same fid.

And later:

A client can send multiple T-messages without waiting for
the corresponding R-messages, but all outstanding T-messages
must specify different tags.  The server may delay the
response to a request and respond to later ones; this is
sometimes necessary, for example when the client reads from
a file that the server synthesizes from external events such
as keyboard characters.


This is a very interesting feature, allowing a sort of proxing at
connection level.
Such a proxy could accept 9P connections on a socket and forward them to a
remote server (after modifying fids and tags so that they are kept unique),
largely improving scalability.
If available, I'd really like to read such code.

BTW, is there any client library that actually enables consumers to send
multiple T-messages without waiting the corresponding R-messages and then
consume responses when they arrive?

All the 9p implementations that I saw were synchronous, allowing only one
client per connection.


Where can I find an implementation of these features?
I guess it would be a really instructive read.


Giacomo


Re: [9fans] wstat and atomic directory change

2015-02-04 Thread Giacomo Tesio
And unfortunately I cannot figure out any alternative, either. :-(

An interesting point is: why directory entries can be read but cannot be
written? I mean we use Tcreate to create a new file in a dir, while to be
uniform with files, we should use a Twrite, appending a corresponding stat
structure at the end of a directory entry.

However this solution probably has not been adopted to enable safe
concurrency in the file creation and removal.

However this asymmetry shows that directories cannot be (pratically)
handled in the same way of files.


Giacomo


2015-02-04 15:06 GMT+01:00 erik quanstrom quans...@quanstro.net:

  You are right.
  But since protocol customizations goes against that same ideal, what's
 the
  plan9 way of dealing with a feature X (in this specific case atomic file
  moves)?
 
 
   this requires delving into the namespace to tell that the directories
 are
   still under the
   same mount, and some non-uniform operations.
  
 
  Good point. But thus, what are the alternatives?

 i wasn't holding out.  i don't have any suggestions.

 - erik




Re: [9fans] wstat and atomic directory change

2015-02-05 Thread Giacomo Tesio
Actually I've found a 9 years old mail about Tmove:
http://comp.os.plan9.narkive.com/xYi8Vg5d/9fans-fuse-bashing#post40

I'm not an advocate of Tmove in any way, but I can't really grasp the cons.
I'm sure that its omission was an explicit design choise, but where I
can read about the arguments that lead to such decision?


Giacomo

2015-02-05 9:21 GMT+01:00 Giacomo Tesio giac...@tesio.it:
 2015-02-05 5:13 GMT+01:00 lu...@proxima.alt.za:

  But why we don't have Tmove for example?

 Because its semantics are much, much more complex and the users need
 to be aware of the difference.

 This shouldn't be so hard to obtain.

 I mean we could simply introduce a new command rename oldpath
 newpath that only works when both path share the same mount point.
 This way the mv commands would keep the old safe semantic, while the
 new command would protect the user to accidentally disclosure his data
 to the world via the cloud.

  Imagine a Tmove that transfers your
 entire disk contents to the cloud: would you like it to be perceived
 as trivial?  What happens if you interrupt it?  Worse, what happens if
 you can't interrupt it?

 I won't be drammatic: you can always unplug the enthernet! :-D

 Btw, I see the point.


 Giacomo



Re: [9fans] wstat and atomic directory change

2015-02-05 Thread Giacomo Tesio
Il 05/Feb/2015 17:26 erik quanstrom quans...@quanstro.net ha scritto:

  I'm wondering for a
  synthetic filesystem in which, when you move a folder in a special
  directory, something magic happens.
  As far as I can see, it is not possible with a 9p2000 fileservice, is
it?

 i don't see why you can't make a magic directory that works that way.


How? Which 9p message would trigger the magic?

I just see 2 options:
1. Have a control file
2. Use custom wstat with full path to move

But if both are wrong, I'm lost.

Giacomo


[9fans] telnet to port (and webfs debug)

2015-02-12 Thread Giacomo Tesio
Hi, I'm having an hard time to debug a problem with http clients in
plan9/qemu (actually 9front, but I guess my questions apply to all
plan9 versions).

DNS and ping works properly, just http fails.

I suspect it's a proxy issue. I have set httpproxy environment
variable but with no success: both hget and mothra doesn't works.

I can connect to the qemu host webserver on port 80 and receive the
proper page, but for any other address I can't obtain a response.

The proxy does not log any access.

Now, to debug this issue, I'd like to telnet the proxy port and
manually forge an http request.

However I can't understand hot to specify a port reading man telnet.

What's plan9 equivalent of

   telnet www.google.com 80



Giacomo



Re: [9fans] telnet to port (and webfs debug)

2015-02-13 Thread Giacomo Tesio
I did already tried this, but without success, but I tried it again
just to be sure, still without success.

I tried to telnet the proxy with telnet tcp!host!port and it worked as
expected (GET http://www.google.com; printed its bloated html).

This limit the issue boundaries to webfs (since, as far as I can see,
hget is just a wrapper of it), since both squid and the tcp stack
proved to work properly.


The problem is, I can't figure out how to debug webfs. Any tip?

Note that it worked once, a few days ago, when I managed to sysupdate
(setting http_proxy.host in /usr/glenda/.hgrc).



Giacomo



2015-02-12 17:27 GMT+01:00  cinap_len...@felloff.net:
 the httpproxy variable is read by webfs on startup only. webfs is usually
 started in your $home/lib/profile to provide http client service.

 just setting httpproxy before running hget or mothra has no
 effect on the proxy setting unless you start a new webfs instance.

 so try:

 httpproxy=http://proxy:port
 webfs
 hget http://www.google.com/

 when that works, set the httpproxy variable at the top of your
 $home/lib/profile before webfs is started to make it permanent.

 --
 cinap




[9fans] pkg(1) and tbz2

2015-02-19 Thread Giacomo Tesio
Hi, with the hope to port a (complex) tool to plan9 I've found this
interesting repo with an updated ape + gcc + some other useful
tools...

http://marcus.biz.tm/files/

I tried to set the pkgpath to that url but pkg/list only show the two
packages named .tbz2 (lighthttp and m4).

I noted that all files in http://9front.org/pkg/386/ are tbz.

I'd like to know if (and how) I could install the tar.gz and tar.bz2
packages from that repo or I have to manually download them, repackage
as with pkg/create and then install from a local pkgpath.


Thanks for your help!


Giacomo



Re: [9fans] pkg(1) and tbz2

2015-02-19 Thread Giacomo Tesio
Ops. Sorry I thought I was writing to 9front.

Thanks for your help!

Giacomo
Il 19/Feb/2015 12:49 Álvaro Jurado elbingm...@gmail.com ha scritto:

 First, you need a gcc to compile gcc. There is a complete set here
 https://drive.google.com/folderview?id=0B6YNt0aHfaA0am1oNGNSR3pXU1Uusp=sharing#list
  (get
 more recent), and a clue about configures here
 http://marcus.biz.tm/files/configure.txt.
 But I'm sure that 9fans list don't want any noise about this. So ask there
 where you found that soft.


 Álvaro Jurado Cuevas
 colmenar.biz.tm

 2015-02-19 12:30 GMT+01:00 Giacomo Tesio giac...@tesio.it:

 So have  I any hope to compile them?

 Giacomo

 2015-02-19 12:24 GMT+01:00 Álvaro Jurado elbingm...@gmail.com:
  I don't think it can work with pkg.
  Note that it isn't a repo and has only 72 KB/s max uploading rate. So
 it
  means that will be very slow and
  none of that packages was set to work with pkg tool. In most cases they
 are
  only sources.
  And I think gcc bootstrap will be more complicated that a simple
 pkg/create.
 
  Álvaro Jurado Cuevas
 
  2015-02-19 12:01 GMT+01:00 Giacomo Tesio giac...@tesio.it:
 
  Hi, with the hope to port a (complex) tool to plan9 I've found this
  interesting repo with an updated ape + gcc + some other useful
  tools...
 
  http://marcus.biz.tm/files/
 
  I tried to set the pkgpath to that url but pkg/list only show the two
  packages named .tbz2 (lighthttp and m4).
 
  I noted that all files in http://9front.org/pkg/386/ are tbz.
 
  I'd like to know if (and how) I could install the tar.gz and tar.bz2
  packages from that repo or I have to manually download them, repackage
  as with pkg/create and then install from a local pkgpath.
 
 
  Thanks for your help!
 
 
  Giacomo
 
 





[9fans] A few questions about 9p

2015-01-29 Thread Giacomo Tesio
Hi, I'm coding a small .NET library to connect 9p2000 services and I have a
few questions about things that the manual doesn't explain (or I was not
able to find).

What's the meaning of qids? I see that responses often include them but
request messages do not.

What's the proper message sequence to delete a file? And to delete a non
empty directly?

Is it possible to move a file between different directories atomically?

I can't find details on the file execution permission: looks like a
malicious client could just ignore it on files and execute anything that it
can read (obviously I'm just talking about single files,  not directory).

When I should clunk the afid?

What about encryption? Is it completely delegated to the transport layer?

Thanks for your help!

Giacomo


Re: [9fans] A few questions about 9p

2015-01-29 Thread Giacomo Tesio
Il 29/Gen/2015 11:12 Charles Forsyth charles.fors...@gmail.com ha
scritto:


 On 29 January 2015 at 09:04, Giacomo Tesio giac...@tesio.it wrote:

 What's the meaning of qids? I see that responses often include them but
request messages do not.

 see intro(5) or intro(9P) depending on system. They identify a file
on a server; they are a value provided by the server to the client,
 so they only appear in replies.

Thanks Charles for your answer.
Actually I can't imagine it's usage in the client.  I mean: clients should
use path to identify files, shouldn't them?


 What's the proper message sequence to delete a file? And to delete a non
empty directly?

 You point a fid at the file, then remove it:Twalk* ... Tremove
 A non-empty directory can't be removed.
 Tremove implies Tclunk

Ehm... I didn't saw the Tremove message.. sorry.


 I can't find details on the file execution permission: looks like a
malicious client could just ignore it on files and execute anything that it
can read (obviously I'm just talking about single files,  not directory).

 It's not malicious, just incorrect. Obviously you can't execute a
remote image or script unless you read it.

By malicious I mean that the client could execute a script that it wasn't
allowed to.

Actually if we separate storage and execution, that's probably inevitable.


 When I should clunk the afid?

 When the client closes it.

Ok but when should the client close it?

Is it still valid to Tattach after the afid has been closed? How many
times? I'm thinking about potential security issues allowing an attacker to
attach a file server just guessing the afid provided by another user.

Thanks again for your help!

Giacomo


Re: [9fans] A few questions about 9p

2015-01-29 Thread Giacomo Tesio
Actually I wasn't able to understand when the afid was supposed to be clunk
reading attach 5.

I was in doubt that the afid had to be the last fid clunked.

Giacomo
Il 29/Gen/2015 15:56 cinap_len...@felloff.net ha scritto:

   size[4] Tattach tag[2] fid[4] afid[4] uname[s] aname[s]
   size[4] Rattach tag[2] qid[13]

 you have to provide the afid in the Tattach, so clunking it before
 attach makes no sense. you can pass NOFID to Tattach when when the
 fileserver doesnt support authentification.

 you can also reuse the afid, so keeping it arround after Tattach
 works just fine.

 if you only want todo a single attach, you can clunk it after the
 Tattach.

 its all documented and better worded in attach(5).

 --
 cinap




Re: [9fans] telnet to port (and webfs debug)

2015-02-12 Thread Giacomo Tesio
Yes hget is an rc script running on webfs.

Giacomo
Il 12/Feb/2015 13:14 Quintile st...@quintile.net ha scritto:

 I have s feeling that get is a script that accesses webfs, and maybe the
 9front mothers does the same. are you running webfs?

 -Steve





  On 12 Feb 2015, at 11:02, Giacomo Tesio giac...@tesio.it wrote:
 
  Hi, I'm having an hard time to debug a problem with http clients in
  plan9/qemu (actually 9front, but I guess my questions apply to all
  plan9 versions).
 
  DNS and ping works properly, just http fails.
 
  I suspect it's a proxy issue. I have set httpproxy environment
  variable but with no success: both hget and mothra doesn't works.
 
  I can connect to the qemu host webserver on port 80 and receive the
  proper page, but for any other address I can't obtain a response.
 
  The proxy does not log any access.
 
  Now, to debug this issue, I'd like to telnet the proxy port and
  manually forge an http request.
 
  However I can't understand hot to specify a port reading man telnet.
 
  What's plan9 equivalent of
 
telnet www.google.com 80
 
 
 
  Giacomo




Re: [9fans] Very old bug in db(1)

2015-03-19 Thread Giacomo Tesio
I could be wrong, but looks like nobody cares about such small fixes.

A few days ago, I've found some very old small errors (one in the 2c(1) man
page and one in col(1) that affects man pages' visualization in variable
width fonts) but had no feedback.
I guess that the most effective way to cope with such old and small bugs,
is to report them on 9fans (and other related mailing lists), possibly with
a patch.
This way, any other user that hit the bug (and find your email) can apply
the patch and fix them in his $home/bin (or somewhere else) and then bind
-b it to /bin.


Giacomo

2015-03-19 7:41 GMT+01:00 Roberto E. Vargas Caballero k...@shike2.com:

 I was doing some experiments with db(1), when I tried something like:

 main:b *argv/X

 and it gave me an error. I debugged it and I found that is a bug in the
 code due to a mix between char* and Rune*. I have created a patch
 in sources with the name unicode-db.

 The funny thing is this error must be at least 20 years old,
 because clearly its origin is the unicode translation of old unix tools.
 I have checked  labs, 9front and plan9port and all of them have
 the error (in some moment someone realized about a warning
 of the compiler about different pointer types and simply put a
 cast, that is not present in the code of plan9port).

 I send this mail here, first because I think is the error is funy,
 second because is my first patch send to plan9 and I'm not sure about
 the process, and third because it affects to all the versions of plan9
 and I'm not sure if all of them take this bug fixes from sources.

 Regards,





Re: [9fans] Very old bug in db(1)

2015-03-19 Thread Giacomo Tesio
Oh, I completely missed patch(1). And actually it was just when one should
look up for at first... man pages. Sorry.

Thanks for the tip!

It's a fragmented small community and that is just sad.  It is not
 likely that things will get better in the foreseeable future, so pick
 your side :-)


To pick a side, one should knows the contenders enough. :-)
It's very hard to find clear statements about the differences between the
various plan9 flavours, or clear descriptions of the vision driving the
development of each fork (at least I wasn't able to find them).
This is particularly true for plan9 forks that bet on Plan9 evolution
outside bell labs (9atom and 9front), while it's easy to get the
differences between 9legacy, Inferno, Nix-os etc...

More than 15 years ago, when I started using linux, it was easy to see how
Debian was different from RedHat or Suse.
In the Plan9 ecosystem, while looks that some are quite upsets about such
differences, it's hard to grasp them from the outside.


Giacomo


[9fans] col.c: one line fix for variable-width font

2015-03-06 Thread Giacomo Tesio
I gave a look at col.c and found a better fix for the tabs issue.

We simply need that col check for the previous char being a space, before
adding any tab. That is, at /sys/src/cmd/col.c:251 replace

if ((++ncp  7) == 0  !xflag) {

with

if ((++ncp  7) == 0  !xflag  *(p-2) == ' ') {

This is a better fix that redefining col in /rc/bin/man since this way col
correctly replace spaces with tabs when appropriate. It just stops to
replace single spaces at positions multiple of 8 with tabs.


Giacomo
PS: col.c ignores $tabstop. This could be something to add in the man page.
Or to fix in col.c (a really trivial fix, btw)


Re: [9fans] col.c: one line fix for variable-width font

2015-03-06 Thread Giacomo Tesio
Actually I'm using drawterm, as a sort of remote desktop connection. But I
can't see the problem you are talking about.
The clients (either windows or linux) don't have the font installed, but
still it seem working pretty well (except for the spacing issues in man
pages). I don't have a real monitor attached to the xen server, so I can't
try it without drawterm.

col.c just ignores $tabstop in it's source code. It use a Tabstop = 8
constant instead (and a 7 value to check for position).
Changing the code to use $tabstop is trivial, and I even tried it, but it
neither fixed the initial problem nor decreased the man output size enough
to justify it's proposal.

I'm going to write a sed script to remove the leading margin (but not every
space or tab at the beginning of each line) from nroff output so that (with
my font and my 14inches monitor) I can use a 3 column acme to browse
/sys/src/  read the code  browse man pages.
This should also reduce the man output size more than col.


Giacomo

2015-03-06 17:33 GMT+01:00 erik quanstrom quans...@quanstro.net:

 On Fri Mar  6 04:57:18 PST 2015, giac...@tesio.it wrote:

  if ((++ncp  7) == 0  !xflag) {
 
  with
 
  if ((++ncp  7) == 0  !xflag  *(p-2) == ' ') {

 that solves it.  you have a problem with $tabstop.  if you've cpu'd
 or ssh'd somewhere, make sure the $tabstop is set properly, and that
 the font you are using is available on the remote host, and $font
 is pointing to it.

 - erik




Re: [9fans] col.c: one line fix for variable-width font

2015-03-06 Thread Giacomo Tesio
ehm... well... actually I could try with vnc... :-)


Giacomo

2015-03-06 18:22 GMT+01:00 Giacomo Tesio giac...@tesio.it:

 Actually I'm using drawterm, as a sort of remote desktop connection. But I
 can't see the problem you are talking about.
 The clients (either windows or linux) don't have the font installed, but
 still it seem working pretty well (except for the spacing issues in man
 pages). I don't have a real monitor attached to the xen server, so I can't
 try it without drawterm.

 col.c just ignores $tabstop in it's source code. It use a Tabstop = 8
 constant instead (and a 7 value to check for position).
 Changing the code to use $tabstop is trivial, and I even tried it, but it
 neither fixed the initial problem nor decreased the man output size enough
 to justify it's proposal.

 I'm going to write a sed script to remove the leading margin (but not
 every space or tab at the beginning of each line) from nroff output so that
 (with my font and my 14inches monitor) I can use a 3 column acme to browse
 /sys/src/  read the code  browse man pages.
 This should also reduce the man output size more than col.


 Giacomo

 2015-03-06 17:33 GMT+01:00 erik quanstrom quans...@quanstro.net:

 On Fri Mar  6 04:57:18 PST 2015, giac...@tesio.it wrote:

  if ((++ncp  7) == 0  !xflag) {
 
  with
 
  if ((++ncp  7) == 0  !xflag  *(p-2) == ' ') {

 that solves it.  you have a problem with $tabstop.  if you've cpu'd
 or ssh'd somewhere, make sure the $tabstop is set properly, and that
 the font you are using is available on the remote host, and $font
 is pointing to it.

 - erik





Re: [9fans] 2c(2) error

2015-03-10 Thread Giacomo Tesio
Ehm... obviously I was talking about 2c(1)...

Too much coffe, today... :-D

2015-03-10 16:53 GMT+01:00 Giacomo Tesio giac...@tesio.it:

 2c(2) states:

 Array initializers can specify the indices of the array in
   square brackets, as
   int a[] = { [3] 1, [10] 5 };
   which initializes the third and tenth elements of the
   eleven-element array a.


 This is somewhat confusing: the third and the tenth element should have
 index 2 and 9. Moreover if the tenth element is actually referred by index
 10, why the array should hold eleven elements?

 A simple check shows that actually the array has 11 elements and the one
 initialized are the forth and the eleventh.


 Giacomo



[9fans] 2c(2) error

2015-03-10 Thread Giacomo Tesio
2c(2) states:

Array initializers can specify the indices of the array in
   square brackets, as
   int a[] = { [3] 1, [10] 5 };
   which initializes the third and tenth elements of the
   eleven-element array a.


This is somewhat confusing: the third and the tenth element should have
index 2 and 9. Moreover if the tenth element is actually referred by index
10, why the array should hold eleven elements?

A simple check shows that actually the array has 11 elements and the one
initialized are the forth and the eleventh.


Giacomo
diff -r 51285ae4f545 sys/man/1/2c
--- a/sys/man/1/2c  Thu Mar 05 10:17:23 2015 +0100
+++ b/sys/man/1/2c  Tue Mar 10 16:52:03 2015 +0100
@@ -250,7 +250,7 @@
 .EX
 int a[] = { [3] 1, [10] 5 };
 .EE
-which initializes the third and tenth elements of the eleven-element array
+which initializes the forth and eleventh elements of the eleven-element array
 .BR a .
 .TP
 \-


Re: [9fans] jas' cpython

2015-03-25 Thread Giacomo Tesio
Thanks David!

2015-03-25 12:12 GMT+01:00 David du Colombier 0in...@gmail.com:

  How should I extract files from an .arch archive?

 disk/mkext -d /  cpython-src.arch

 --
 David du Colombier




Re: [9fans] using git

2015-03-30 Thread Giacomo Tesio
Ah, a small addendum: obviously we also use tags a lot to give a specific
commit (and related history) a name.
This is done automatically by build servers for the official tags, and
manually by developers whenever they want in their own repository (often
with tags like, workedhere, shittorefactortomorrow and so on).


Giacomo

2015-03-30 11:48 GMT+02:00 Giacomo Tesio giac...@tesio.it:

 As I use both git and hg, I really miss the feature-branching in hg
 (obviously, you can, if you try hard enough, use feature branching with hg
 too, but git makes it so easy that it became my default process whenever I
 can use git for development, even on solo projects):

 Suppose you have a team of 3 or more people and a central git server
 that can be used for facility of share (company server, github, bitbucket,
 gitorious...): each person start working on a issue (let it be a bug to fix
 or a new feature to implement) by doing on his working copy

 git checkout -b feature-nickname


 than it change anything that he consider relevant, committing whenever he
 decides that a change can be described in a sensible way:

 git commit -am 'OptimizingVisitor applies DeMorgan laws'

 ... a few work after...
 git commit -am 'OptimizingVisitor detects constants predicates'


 At any time, each developer can push the changes to the central server, to
 share his progresses and without the pain to merge them until the full
 issue has been addressed.

 The next day, a different developer could continue his work if it's really
 required (rarely, but it happened).

 When the feature has been fully implemented, the dev can merge it into the
 shared branch (master, or development when a human-driven test process is
 required before the production deployment).

 We do not use rebase: we want to keep track of which code the dev was
 seeing while writing his changes.

 At any time, we can see what features have been released, looking at which
 branches have been merged in the shared branch.


 On medium to large projects (5 to 20 people) this process allows a fast,
 painless collaboration.

 Still, whenever I can use git, I use it for my solo projects too, and I
 find it quite good to keep track of the progress of the project.


 My two cents.


 Giacomo


 2015-03-28 15:00 GMT+01:00 Paul Lalonde paul.a.lalo...@gmail.com:

 I'd like to hear it too - much to learn from others' process.
 Paul

 On Sat, Mar 28, 2015 at 4:16 AM Charles Forsyth 
 charles.fors...@gmail.com wrote:


 On 19 March 2015 at 18:26, arn...@skeeve.com wrote:

 Charles Forsyth charles.fors...@gmail.com wrote:

  On 19 March 2015 at 16:09, arn...@skeeve.com wrote:
 
   There is definitely some
   learning curve and mindset change
 
  Just what I want from a little servant that's supposed to help me
 manage
  some file changes.

 Git is intended for something completely different than RCS.

 I really, REALLY, don't want to start a flame war, although this being
 9fans, it's probably not possible. More's the pity.

 And again, I AM NOT trying to proselytize.  But, if you are curious as
 to what value I personally found in git for gawk development, I will be
 happy to discuss it in personal email.


 Unfortunately, switching between different devices I missed this reply.
 I wasn't really comparing it to RCS although I can see that was a
 reasonable conclusion from my wording.


 It might be worthwhile sending a brief description of what you use and
 what you find valuable to the list.
 There isn't much traffic at the moment.





Re: [9fans] using git

2015-03-30 Thread Giacomo Tesio
As I use both git and hg, I really miss the feature-branching in hg
(obviously, you can, if you try hard enough, use feature branching with hg
too, but git makes it so easy that it became my default process whenever I
can use git for development, even on solo projects):

Suppose you have a team of 3 or more people and a central git server that
can be used for facility of share (company server, github, bitbucket,
gitorious...): each person start working on a issue (let it be a bug to fix
or a new feature to implement) by doing on his working copy

git checkout -b feature-nickname


than it change anything that he consider relevant, committing whenever he
decides that a change can be described in a sensible way:

git commit -am 'OptimizingVisitor applies DeMorgan laws'

... a few work after...
git commit -am 'OptimizingVisitor detects constants predicates'


At any time, each developer can push the changes to the central server, to
share his progresses and without the pain to merge them until the full
issue has been addressed.

The next day, a different developer could continue his work if it's really
required (rarely, but it happened).

When the feature has been fully implemented, the dev can merge it into the
shared branch (master, or development when a human-driven test process is
required before the production deployment).

We do not use rebase: we want to keep track of which code the dev was
seeing while writing his changes.

At any time, we can see what features have been released, looking at which
branches have been merged in the shared branch.


On medium to large projects (5 to 20 people) this process allows a fast,
painless collaboration.

Still, whenever I can use git, I use it for my solo projects too, and I
find it quite good to keep track of the progress of the project.


My two cents.


Giacomo


2015-03-28 15:00 GMT+01:00 Paul Lalonde paul.a.lalo...@gmail.com:

 I'd like to hear it too - much to learn from others' process.
 Paul

 On Sat, Mar 28, 2015 at 4:16 AM Charles Forsyth charles.fors...@gmail.com
 wrote:


 On 19 March 2015 at 18:26, arn...@skeeve.com wrote:

 Charles Forsyth charles.fors...@gmail.com wrote:

  On 19 March 2015 at 16:09, arn...@skeeve.com wrote:
 
   There is definitely some
   learning curve and mindset change
 
  Just what I want from a little servant that's supposed to help me
 manage
  some file changes.

 Git is intended for something completely different than RCS.

 I really, REALLY, don't want to start a flame war, although this being
 9fans, it's probably not possible. More's the pity.

 And again, I AM NOT trying to proselytize.  But, if you are curious as
 to what value I personally found in git for gawk development, I will be
 happy to discuss it in personal email.


 Unfortunately, switching between different devices I missed this reply.
 I wasn't really comparing it to RCS although I can see that was a
 reasonable conclusion from my wording.


 It might be worthwhile sending a brief description of what you use and
 what you find valuable to the list.
 There isn't much traffic at the moment.




Re: [9fans] using git

2015-03-30 Thread Giacomo Tesio
Actually, Jeff I appreciate a lot your work on mercurial. I know I could
use the bookmarks extension to achieve a similar process with hg (never
tried darcs and bzr seriously, sorry). but I still prefer git to mercurial,
since it has been designed around the features that I like (when working
alone) or need (when working in large team over years long projects).

But this is personal taste, and I'm not a git evangelist. I just replied to
Charles asking for the features we use in git.

Btw, ever heard of http://libgit2.org ?
Plain c89. No external dependencies.

In theory, one could implement a native gitfs over that, in C, using the
network fs available in Plan9.

Compared to hgfs, a bit more design of the fs structure would probably be
needed to capture the concept of branch in a hierarchical filesystem.

How much you would estimate such development?


Giacomo



2015-03-30 18:16 GMT+02:00 Jeff Sickel j...@corpus-callosum.com:


  On Mar 30, 2015, at 4:55 AM, Giacomo Tesio giac...@tesio.it wrote:
 
  Ah, a small addendum: obviously we also use tags a lot to give a
 specific commit (and related history) a name.
  This is done automatically by build servers for the official tags, and
 manually by developers whenever they want in their own repository (often
 with tags like, workedhere, shittorefactortomorrow and so on).

 All of those features are available in hg, darcs, and other dscm tools.

 But to get back on topic, unless I’ve overlooked a contrib package
 somewhere, how about we begin with the requirements to get a fully working
 git installed on Plan 9.  For example,

 ## the dependencies required for git on a bare-bones FreeBSD install:
 # pkg install git
 Updating FreeBSD repository catalogue...
 FreeBSD repository is up-to-date.
 All repositories are up-to-date.
 The following 18 packages will be affected (of 0 checked):

 New packages to be INSTALLED:
 git: 2.3.4
 expat: 2.1.0_2
 p5-Authen-SASL: 2.16_1
 p5-GSSAPI: 0.28_1
 perl5: 5.18.4_11
 p5-Digest-HMAC: 1.03_1
 p5-Net-SMTP-SSL: 1.01_3
 p5-IO-Socket-SSL: 2.012
 p5-Mozilla-CA: 20141217
 p5-Net-SSLeay: 1.68
 p5-Socket: 2.018
 p5-IO-Socket-IP: 0.37
 python27: 2.7.9
 libffi: 3.2.1
 p5-Error: 0.17023
 curl: 7.41.0
 ca_root_nss: 3.18
 cvsps: 2.1_1



 I’m not sure what cvsps is for, that seems to have cropped up on the fbsd
 pkg sometime between git versions 2.3.1 and 2.3.4.  It’s been
 years^wdecades since I’ve tinkered with perl, and I’m fairly certain the
 perl 5.8 version available on Plan 9 won’t support the modules included in
 the above list.  So Plan 9 needs a modern perl to run git effectively with
 specific attention to the additional modules.  Expat is the “eXpat XML
 parser library”.  Libffi is something maintained on sources.redhat.com.
 Many of those modules depend on OpenSSL, so add that to the list.  It’s
 also possible a recent port of bash will also be required as the git
 support scripts may not work with our ape/sh or ape/psh.  We’ve got python
 2.7.8 [.9 soon] covered.

 Piece of cake, all that should fit on a coaster.

 -jas








Re: [9fans] drawterm sources

2015-03-02 Thread Giacomo Tesio
Thanks a lot! :-D


Giacomo

2015-03-02 11:55 GMT+01:00 yy yiyu@gmail.com:
 On 2 March 2015 at 11:06, Giacomo Tesio giac...@tesio.it wrote:
 - where I can find the most updated sources of drawterm? (links from
 http://swtch.com/drawterm/ seem to be broken)

 https://bitbucket.org/rsc/drawterm

 - Is there any simpler solution? Buying a three-button mouse is quite
 hard in Italy, and above all its usage is not viable on my couch...
 :-)

 I like to use the wheel for chording (patched acme in contrib). This
 works well with the trackpad in my laptop too. YMMV.


 --
 - yiyus || JGL .




[9fans] drawterm sources

2015-03-02 Thread Giacomo Tesio
Hi, to ease my usage of drawterm from my hp chromebook I'm using
xbindkeys + xdotool to send mouse events on a few keyboard's events.

In particular
AltGr + Left = mouse 1
AltGr + Up = mouse 2
AltGr + Right = mouse 3

This way I can choord even without a 3 button mouse.
This works quite well, but I had to disable X autorepeat with `xset
-r` before starting drawterm but it's quite annoing out of drawterm.

So I'm going to use xdotool behaviours to disable autorepeat when the
mouse enter drawterm and enable it again when it leaves.

However a better approach (for my usecase) would be to have drawterm
ignoring autorepeated events just for these key combinations.

So I'm wondering how hard is to hack drawterm.  Here my questions:

- where I can find the most updated sources of drawterm? (links from
http://swtch.com/drawterm/ seem to be broken)
- Is there any simpler solution? Buying a three-button mouse is quite
hard in Italy, and above all its usage is not viable on my couch...
:-)


Thanks for your help!


Giacomo



[9fans] unexpected tabs in man pages after font change

2015-03-04 Thread Giacomo Tesio
Hi, I've just installed a compact sans font (from
http://input.fontbureau.com/ ) and manual pages started to look broken.

As you can see in the screenshot (man 2 control), there are white spaces
that looks like tabs in the middle of the text with apparently no reason.
Even in the troff source (why the hell we still use troff for manual pages?
:-D) I can see no command that explain this behaviour.

Any tip to fix them?


Giacomo

[image: Immagine in linea 1]


Re: [9fans] unexpected tabs in man pages after font change

2015-03-04 Thread Giacomo Tesio
Interestingly enough the problem disappears with a mono font.

I suspect that troff is inserting such tabs instead of spaces when it
thinks they are the same. Indeed libframe (as far I could understand from
the manual and the sources) properly handles such variable width fonts.

Looks like I've to inform troff about the glyphs sizes... but how?


Giacomo

2015-03-04 17:13 GMT+01:00 Giacomo Tesio giac...@tesio.it:

 Hi, I've just installed a compact sans font (from
 http://input.fontbureau.com/ ) and manual pages started to look broken.

 As you can see in the screenshot (man 2 control), there are white spaces
 that looks like tabs in the middle of the text with apparently no reason.
 Even in the troff source (why the hell we still use troff for manual
 pages? :-D) I can see no command that explain this behaviour.

 Any tip to fix them?


 Giacomo

 [image: Immagine in linea 1]



Re: [9fans] unexpected tabs in man pages after font change

2015-03-04 Thread Giacomo Tesio
Well... docx, obviously! :-D

Seriously, a markdown/asciidoc like language would be far easier to
write and update.
We could even compile it to troff, we we had to print it.

However, this is not a rant specific to plan9. Linux is not better
from this point of view.


Giacomo

2015-03-04 22:31 GMT+01:00 Aram Hăvărneanu ara...@mgk.ro:
 On Wed, Mar 4, 2015 at 5:13 PM, Giacomo Tesio giac...@tesio.it wrote:

 why the hell we still use troff for manual pages?

 What do you propose we use instead?

 --
 Aram Hăvărneanu




Re: [9fans] unexpected tabs in man pages after font change

2015-03-04 Thread Giacomo Tesio
2015-03-05 0:56 GMT+01:00 s...@9front.org:

  And btw, programs don't write man pages... yet.

 Are you familiar with the conventions that power godoc?


No, but I know quite well it's predecessors (Docstrings, Javadoc etc...).

They are great for API, but IMHO not every unix man page can be generated
from code. They are a specialized kind of prose.

What I can't undestand I why we still need troff for them.

It's almost like using a teletype to chat! :-)


Giacomo


Re: [9fans] unexpected tabs in man pages after font change

2015-03-04 Thread Giacomo Tesio
Well, while a bit offtopic... what do you mean by programmatically.

And btw, programs don't write man pages... yet.


Giacomo

2015-03-04 23:39 GMT+01:00 Stanley Lieber s...@9front.org:
 troff is great. easy to maintain programmatically.

 sl




Re: [9fans] unexpected tabs in man pages after font change

2015-03-05 Thread Giacomo Tesio
Which font are you using?
With all mono-spaced (fixed-width) fonts everything works fine. The problem
occurs just with  variable spaced fonts.

Btw I noted that the fix is not perfect: the table at the end of man(1) is
misaligned, with or without the fix. Even without calling col at all.

This could be due to troff assuming fixed with font and inserting spaces
instead of tabs. And its a pity, because  probably libframe would align
tabs properly.

But this is just a guess, I had no time to check the troff code for this
second issue.

Giacomo
Il 05/Mar/2015 15:23 erik quanstrom quans...@quanstro.net ha scritto:

  Interestingly enough the problem disappears with a mono font.
 
  I suspect that troff is inserting such tabs instead of spaces when it
  thinks they are the same. Indeed libframe (as far I could understand from
  the manual and the sources) properly handles such variable width fonts.
 
  Looks like I've to inform troff about the glyphs sizes... but how?

 i don't use a mono font so i don't like your col -x solution, and this
 works for me regardless.

 if $font is set correctly, i believe all this should work out.  make sure
 that $tabstop=acme tabstop as well.  the default for acme is 4, but
 it is imported by $tabstop, and overridden with Tab.

 cpu'ing can screw with your $font.

 - erik




[9fans] rc: pwd in $prompt

2015-02-26 Thread Giacomo Tesio
Hi, I'm a bit dumb, but reading rc(1) I can't grasp how I can have the
current dir printed in prompt.

Is it possible at all?


Giacomo



Re: [9fans] rc: pwd in $prompt

2015-02-26 Thread Giacomo Tesio
Ops... Thanks! :-)


Giacomo

2015-02-26 11:08 GMT+01:00 Álvaro Jurado elbingm...@gmail.com:
 http://www.plan9.bell-labs.com/wiki/plan9/Tip_o%27_the_day/index.html

 To set your prompt in rc to reflect your current directory add this to your
 profile part.

 Álvaro Jurado Cuevas
 colmenar.biz.tm

 2015-02-26 10:59 GMT+01:00 Giacomo Tesio giac...@tesio.it:

 Hi, I'm a bit dumb, but reading rc(1) I can't grasp how I can have the
 current dir printed in prompt.

 Is it possible at all?


 Giacomo





[9fans] jas' cpython

2015-03-25 Thread Giacomo Tesio
I feel a bit dumb, but I can't grasp how to extracts file from

http://plan9.bell-labs.com/sources/contrib/jas/cpython-src.arch.bz2

and

http://plan9.bell-labs.com/sources/contrib/jas/hg-src.arch.bz2


tar(1), gzip(1) and ar(1) did not helped.

How should I extract files from an .arch archive?


Giacomo


[9fans] wstat and atomic directory change

2015-01-30 Thread Giacomo Tesio
Hi, I'm wondering about the validity of an interpretation of intro(5) and
stat(5) that could allow a server to atomically change the directory of a
file.

From intro(5) http://man.cat-v.org/9front/5/intro

The notation
string[s] (using a literal s character) is shorthand for
s[2] followed by s bytes of UTF-8 text.  (Systems may choose
to reduce the set of legal characters to reduce syntactic
problems, for example to remove slashes from name compo-
nents, *but the protocol has no such restriction*.  Plan 9
names may contain any printable character (that is, any
character outside hexadecimal 00-1F and 80-9F) except
slash.).


 wstat(5) http://man.cat-v.org/9front/5/stat on the other hand does not
say much about the name field of Fcall:

The name can be changed by anyone with write
permission in the parent directory; it is an error to change
the name to that of an existing file.

Now, since the protocol does not restrict names (even if Plan 9 does it),
I'm wondering if setting the name to a full path starting from root could
be used to change atomically the directory of a file (given the write
permission on both original and target directory).

Obviously I'm not referring to Plan 9 file servers (I guess this would be a
non retrocompatbile change), but I'm considering if such interpretation
would be wrong (according to the official specifications).

A server supporting such behaviour could be considered a 9p2000 conformant
server?


Giacomo


Re: [9fans] small VFD display

2015-06-10 Thread Giacomo Tesio
2015-06-09 20:34 GMT+02:00 Ethan Grammatikidis eeke...@fastmail.fm:

 search the web for EWD898. it's a good read; fascinating how little
 has really changed.


I know it's off-topic, but it's funny to compare that Dijkstra's paper with
this video https://www.youtube.com/watch?v=qlRTbl_IB-s (and this site
http://2045.com/ !)

I've just found it, and suddenly I realized that all the crazy ideas I've
got in the past were quite realistic, after all. :-D


Giacomo


Re: [9fans] read9pmsg usage

2015-08-10 Thread Giacomo Tesio
2015-08-10 16:54 GMT+02:00 Charles Forsyth charles.fors...@gmail.com:

 Zero conventionally means end-of-file, but record boundaries are preserved
 on capable streams, so if a writer writes zero, the reader reads zero.


However this two requirements do not seem reconcilable.

Zero can either mean EOF or I'm alive but boring.

I can't see how a reliable communication (a cpu connection for example) can
survive this mismatch.
I'm probably missing something.


Giacomo


Re: [9fans] read9pmsg usage

2015-08-11 Thread Giacomo Tesio
2015-08-11 17:48 GMT+02:00 Charles Forsyth charles.fors...@gmail.com:


 On 10 August 2015 at 15:11, Giacomo Tesio giac...@tesio.it wrote:

 /*
  * reading from a pipe or a network device
  * will give an error after a few eof reads.
  * however, we cannot tell the difference
  * between a zero-length read and an interrupt
  * on the processes writing to us,
  * so we wait for the error.
  */


 it's doubly odd, because there's no reason for an interrupted writer to go
 to the lengths of writing an empty record as a consequence of being
 interrupted. it will waserror out in the writer, so why should an empty
 Block end up on the underlying Queue?


Ah, if only git existed when that comment was written! :-D

When I read that comment I though of a remote user space writer, whose
kernel (an old plan9 version?) on process interrupt gracefully send EOFs to
all chan open for write.

However I wasn't able to find anything concrete prove of this behavior in
the codebase (but maybe I looked at the wrong places)


 In fact, an interrupted writer in devmnt will start the flush(5) protocol,
 so it will be writing Tflush, not empty records.


This is interesting too: I thought that Tflush were for requests that had
not yet been completed. But the interrupted writer could be just waiting. I
mean the chan is open, but its last Twrite has already been replied with a
Rwrite.

In this case, sending a EOF on behalf of a process could have sense... or
not? Probably depends on the interrupt.


Giacomo


Re: [9fans] read9pmsg usage

2015-08-12 Thread Giacomo Tesio
2015-08-12 9:25 GMT+02:00 David du Colombier 0in...@gmail.com:

 This comment is indeed pretty old. It was already present
 in the Second Edition.


So that check is based on pre 9p2000 code? If so, Charles have probably
explained it:

2015-08-10 17:40 GMT+02:00 Charles Forsyth charles.fors...@gmail.com:

 As a further historical note, originally 9P required a stream that
 preseved record boundaries, and the reliable datagram protocol IL/IP and
 pipes did that.


So, seem that ignoring zeros is simply wrong. A residual from the past...


Giacomo


[9fans] read9pmsg usage

2015-08-10 Thread Giacomo Tesio
Hi, I've a probably naive question that I can't figure out.
I've just noticed that fcall(2) states

 Read9pmsg calls read(2) multiple times, if necessary, to
 read an entire 9P message into buf.  The return value is 0
 for end of file, or -1 for error; it does not return partial
 messages.


but I've noticed that a few client does not interpret a 0 return value as a
EOF, eg

https://github.com/brho/plan9/blob/master/sys/src/cmd/usb/lib/fs.c#L604-L606
https://github.com/brho/plan9/blob/master/sys/src/cmd/usb/audio/audiofs.c#L889-L891
https://github.com/brho/plan9/blob/master/sys/src/cmd/aux/searchfs.c#L613-L615
https://github.com/brho/plan9/blob/master/sys/src/cmd/lnfs.c#L547-L551
https://github.com/brho/plan9/blob/master/sys/src/cmd/telco/telco.c#L935-L937

The comment there states that

/*
 * reading from a pipe or a network device
 * will give an error after a few eof reads.
 * however, we cannot tell the difference
 * between a zero-length read and an interrupt
 * on the processes writing to us,
 * so we wait for the error.
 */

However many other fs just handle errors and eof together, for example here:
https://github.com/brho/plan9/blob/master/sys/src/cmd/ip/ftpfs/ftpfs.c#L273-L279

I'm a bit confused about this. What's the proper use of the 0 return value?


Giacomo


Re: [9fans] Harvey OS: A new OS inspired heavily by Plan 9

2015-07-27 Thread Giacomo Tesio
Il 27/Lug/2015 23:47, Skip Tavakkolian 9...@9netics.com ha scritto:

  you are aware of the 9fans' fetish for movies

 and rabbits

...and feticists. ;-)


Re: [9fans] off topic - a good Git reference

2015-10-12 Thread Giacomo Tesio
2015-10-12 19:00 GMT+02:00 Charles Forsyth :

>
> On 12 October 2015 at 17:49, Álvaro Jurado  wrote:
>
>> what ensures sha key is in fs.
>
>
> The reason many of us are a little sceptical about it being fsync as such
> preventing the data appearing
> is that if the git function that writes the key does a write or pwrite,
> the key will be in the file system on Plan 9: there's no need for an fsync
> just to get it there.
> In fact, in Linux there's no need for an fsync just to get it there: it
> only matters in the case of a crash.
>
> If the file system fails or you reset the machine, the intention of the
> fsync will be frustrated, but
> it shouldn't affect normal operation where no file server crash occurs.
>
> As it happens, a wstat that changes nothing can be interpreted by a file
> server to have a similar effect as fsync (see stat(5)).
>

Thus Plan9 HAS fsync! :-o
And it also has server-defined semantics! Very impressive!


Giacomo


Re: [9fans] pthreads

2015-09-01 Thread Giacomo Tesio
2008-12-16 23:16 GMT+01:00 Steve Simon :

> I have a distant memory that somone implemented some of POSIX pthreads
> on plan9, i.e. I want to compile programs that use pthreads under APE.
>
> anyone got any pointers?
>

Hi Steve, did you find anything (even incomplete) back then?


Giacomo


[9fans] u9fs sources

2015-09-01 Thread Giacomo Tesio
Hi, anybody knows where the u9fs sources are currently maintained?

I have just found https://bitbucket.org/plan9-from-bell-labs/u9fs but it's
only linked by an old googlecode repo: I was unable to find any official
link in the bell labs pages.


Giacomo


Re: [9fans] u9fs sources

2015-09-02 Thread Giacomo Tesio
2015-09-02 6:38 GMT+02:00 :

> > I don't think it is currently maintained, but Plan 9 ships with a copy
> > of it under /sys/src/cmd/unix. I used that as the basis of the OpenBSD
> > port.
>
> I have it on my list of urgent tasks to fix u9fs.  The more recent
> copy (details need investigating) fails on NetBSD when encountering
> group IDs that don't have a matching value in /etc/group as well as
> under more mysterious circumstances.  The older copy works adequately
> (very similar platform, not identical), but it seems to care much less
> about group IDs and it seems a waste that somebody would have done a
> lot of work in vain.
>

Nice! Actually, I'm going to need the NetBSD port up and running in the
relatively near future.

A very useful thing to do is to list the known issues.
Even more useful would be to setup a set of failing shell scripts that
reproduces the issues, so that we can use them as tests.


>
> I can find out more about each, but if someone else is willing to
> help, I'd also like to apply similar expertise to add ownership and
> permission settings to NetBSD's variation of v9fs which I presume is
> an analogous problem?
>

I did not know of a v9fs version for NetBSD... Any link?

Actually, I don't care about neither 9p2000.U nor 9p2000.L.

So, feel free to nudge me, if you can add to my rather limited skills,
> the hardware can be made available for development and testing.
>
> Lucio.
>

I shouldn't need any hardware (a Xen domU should be enough), but in case
I'll write you when I'm ready to work on this.

Can you share links to the most updated sources for NetBSD?


Giacomo


Re: [9fans] Privalloc(2) and rfork(RFPROC|RFMEM) (was: a pair nec bugs)

2015-09-05 Thread Giacomo Tesio
... and given getpid(2) implementation, a pid based table could be quite
expensive, since MyStruct is accessed very very often.

2015-09-05 16:03 GMT+02:00 Giacomo Tesio <giac...@tesio.it>:

> 2011-05-20 3:30 GMT+02:00 erik quanstrom <quans...@quanstro.net>:
>
>> one note is that while i'm aware of privalloc(2), i didn't use it.  the
>> implementation doesn't appear correct for shared-memory procs.
>> i think there are two issues
>> - locking is unnecessary.  the only preemptable unit of execution is
>> a process and each process is guarenteed to have its own instance
>> of _privates and _nprivates.
>> - for shared-memory procs, we will run out of privates because
>> the static privinit will be falsely shared.  privinit should be replaced
>> by using a private entry.
>>
>
> In a set of processes that share memory, I need a single per-process
> location to store the address of structure (which is in turn allocated in
> the global memory space).
>
> Privalloc(2) seemed what I need, but seem that I can't use it properly.
>
> In the parent process I do:
>
> 1) initialialize a global variable p = (MyStruct **)privalloc();
> 2) allocate a MyStruct for every process I'm going to spawn
> 3) spawn processes with rfork(RFMEM|RFPROC)
>
> The spawn() function that call rfork takes a MyStruct* as argument and
> assign it to *p in the new process.
> For extra safety I added an assert(*p == nil) just after rfork, and after
> a few (apparently?) successful spawns, the assert fails.
>
> What I need is a sort of thread-local storage for the MyStruct*, so that
> each child process can find it's own dedicated MyStruct.
> I know that could get this with an hashtable based on the pid, but I'd
> prefer to avoid the book keeping if possible.
>
>
> Giacomo
>


[9fans] Privalloc(2) and rfork(RFPROC|RFMEM) (was: a pair nec bugs)

2015-09-05 Thread Giacomo Tesio
2011-05-20 3:30 GMT+02:00 erik quanstrom :

> one note is that while i'm aware of privalloc(2), i didn't use it.  the
> implementation doesn't appear correct for shared-memory procs.
> i think there are two issues
> - locking is unnecessary.  the only preemptable unit of execution is
> a process and each process is guarenteed to have its own instance
> of _privates and _nprivates.
> - for shared-memory procs, we will run out of privates because
> the static privinit will be falsely shared.  privinit should be replaced
> by using a private entry.
>

In a set of processes that share memory, I need a single per-process
location to store the address of structure (which is in turn allocated in
the global memory space).

Privalloc(2) seemed what I need, but seem that I can't use it properly.

In the parent process I do:

1) initialialize a global variable p = (MyStruct **)privalloc();
2) allocate a MyStruct for every process I'm going to spawn
3) spawn processes with rfork(RFMEM|RFPROC)

The spawn() function that call rfork takes a MyStruct* as argument and
assign it to *p in the new process.
For extra safety I added an assert(*p == nil) just after rfork, and after a
few (apparently?) successful spawns, the assert fails.

What I need is a sort of thread-local storage for the MyStruct*, so that
each child process can find it's own dedicated MyStruct.
I know that could get this with an hashtable based on the pid, but I'd
prefer to avoid the book keeping if possible.


Giacomo


Re: [9fans] Privalloc(2) and rfork(RFPROC|RFMEM) (was: a pair nec bugs)

2015-09-06 Thread Giacomo Tesio
2015-09-05 20:47 GMT+02:00 erik quanstrom :

> > May be my problem is that p is global in my case?
>
> global variables are in the bss, and thus shared. p will have
> the same value in each thread, but *p should point into the
> stack, and thus the same virtual address will be mapped to
> different physical pages of memory.
>
> however, if *p is assigned to a non-zero value before the process
> is created, the new page allocated for the new process' stack will
> have a copy of the old value, and thus not be 0.
>
> - erik
>
>
That's exactly what happened.
I misread privalloc(2), and assumed that privalloc()ed addresses were
somehow reset on rfork.
This is probably something to explicitly state the man page.

Thanks you all!


Giacomo


Re: [9fans] Privalloc(2) and rfork(RFPROC|RFMEM) (was: a pair nec bugs)

2015-09-05 Thread Giacomo Tesio
Nice example thanks.

May be my problem is that p is global in my case?

Giacomo
Il 05/Set/2015 18:50, "erik quanstrom"  ha scritto:

> by the way, the following program runs without asserting for me
> with or without the waits.
>
> - erik
>
> ---
>
> #include 
> #include 
>
> void
> task(void **p)
> {
> assert(*p == nil);
> *p = (void*)(uintptr)getpid();
> }
>
> void
> spawn(void (*t)(void**), void **p)
> {
> int pid;
>
> switch(pid = rfork(RFMEM|RFPROC)){
> case -1:
> sysfatal("spawn: rfork: %r");
> case 0:
> t(p);
> exits("");
> default:
> USED(pid);
> return;
> }
> }
>
> void
> main(void)
> {
> int i, k;
> void **p;
> Waitmsg *w;
>
> p = privalloc();
> k = 0;
> for(i = 0; i < 1024; i++){
> spawn(task, p);
> for(k++; k > 16; k--){
> if((w = wait()) == nil)
> break;
> free(w);
> }
> }
> exits("");
> }
>
>


[9fans] segbrk(2) vs friends

2015-12-07 Thread Giacomo Tesio
I'm trying to understand the reason behind the introduction of segbrk(2).

I cannot find a use case in the codebase.

The manual page states that:

The segbrk system call may go away or
be re-implemented to give more general segment control, sub-
suming the functions of brk(2) ,
segflush(2)  and segfree
insegattach(2) .


But given the manpage itself is pretty cryptic, I wonder if it's outdated.
Or if it is actually deprecated.


Do you know any paper that can explain its design and intent?


Giacomo


Re: [9fans] Compiling ken-cc on Linux

2015-11-27 Thread Giacomo Tesio
2015-11-27 13:42 GMT+01:00 <tlaro...@polynum.com>:

> On Fri, Nov 27, 2015 at 09:13:20AM +0100, Giacomo Tesio wrote:
> >
> > I know nothing about compilers, but actually gcc and clang dimension and
> > complexity is astonishing.
>
> It's not astonishing: it's research. They want to prove that a black
> hole does exist.
>

Funny, but actually I was wondering if there is any subtle issue in the
standards of the C language that makes it somehow hard to implement.
For example I've met a few times weird implementations of libraries and
frameworks dictated by broken standards: once they are in, they can never
be removed due to backward compatibility. I thought that Charles (that also
implemented the Limbo compiler) might have referenced these kind of issues
in his pun.


Giacomo


Re: [9fans] Compiling ken-cc on Linux

2015-11-27 Thread Giacomo Tesio
2015-11-27 0:21 GMT+01:00 Charles Forsyth :

>
> On 26 November 2015 at 23:08, Ryan Gonzalez  wrote:
>
>> Holy crap, that's crazy. I built it in debug mode on Linux, but I don't
>> think it used that much. I only have 6 GB right now!
>
>
> You have to remember that a C compiler is one of the largest, most complex
> software components that human beings have ever had to produce.
> The original C reference manual made it look deceptively easy, but really
> there's a ton of stuff going on in there, as you can see.
> How they ever got it going on a system with 64Kbytes of address space,
> I'll never know.
>

I'd love to read more about this, Charles. :-)

I know nothing about compilers, but actually gcc and clang dimension and
complexity is astonishing.
I've always thought that this is due to their desire to compile many
different language optimized for many different OS and architectures on
many different OS and architecture.

Alternative compilers, like tcc, only build C on very few architectures /
os with almost no optimization: they are much smaller, but still not
standard compliant.


How can it be?


Giacomo


[9fans] FP register usage in Plan9 assembler

2016-02-01 Thread Giacomo Tesio
I'm studying the 9front's amd64 kernel, and I'm pretty new to assembler
programming, so sorry if my question is too dumb...

I cannot understand the FP pseudo register usage.
The cpuid function, for example, is implemented as

/*
 * The CPUID instruction is always supported on the amd64.
 */
TEXT cpuid(SB), $-4
MOVLRARG, AX/* function in AX */
CPUID

MOVQinfo+8(FP), BP
MOVLAX, 0(BP)
MOVLBX, 4(BP)
MOVLCX, 8(BP)
MOVLDX, 12(BP)
RET

What I miss is where "info" comes from. I cannot

Apparently the GAS equivalent is:

.align 4
.globl cpuid
cpuid:
mov%ebp,%eax
cpuid
mov0x10(%rsp),%rbp
mov%eax,0x0(%rbp)
mov%ebx,0x4(%rbp)
mov%ecx,0x8(%rbp)
mov%edx,0xc(%rbp)
retq

Thus apparently info+8(FP) becomes 0x10(%rsp)
Why? I know that FP is a pseudo register, but shouldn't it be different
from SP?

And why info's value is 8? Is it the pointer size?

Another example:

TEXT insb(SB), 1, $-4
MOVLRARG, DX/* MOVLport+0(FP), DX */
MOVQaddress+8(FP), DI
MOVLcount+16(FP), CX
CLD
REP;INSB
RET

should be equivalent to

.align 4
.globl insb
insb:
mov%ebp,%edx
mov0x10(%rsp),%rdi
mov0x18(%rsp),%ecx
cld
rep insb
retq

Again I cannot find a definition of address and count, but both seem to be
be valued as 8, why?


Giacomo


Re: [9fans] FP register usage in Plan9 assembler

2016-02-01 Thread Giacomo Tesio
Thanks for the explainations!

I did read in the Pike's paper about the syntax name+offset(FP), but I did
understood that name had to be a symbol already defined, and I was looking
for it in the c code. Sorry for the noise!

This led me to another question, however: I've read before that the plan9
compilers use the stack for va_list, but here the assembler is using it
also for explicit parameters, right?

Is it correct to say that this means that the Plan9 compiler suite *never*
follows the sysV calling convention documented at section 3.2.3 of AMD64
ABI http://www.x86-64.org/documentation/abi.pdf and always pushes
parameters to the stack?


Giacomo



2016-02-01 23:48 GMT+01:00 :

> FP is a translated to a varying offset to SP depending on where in the
> program
> you are. arguments on the stack are padded to 8 bytes on amd64, the first
> argument
> is not passed on the stack on function entry, but passed in BP register
> (RARG is an
> alias for that), however the slot on the stack for first arg is still
> reserved
> so we have a save place to splill it. so 0(FP) is first function argument
> on the
> stack, 8(FP) second argument 16(FP) third ect...
>
> --
> cinap
>
>


Re: [9fans] FP register usage in Plan9 assembler

2016-02-01 Thread Giacomo Tesio
I kinda agree, but I'm too incompetent in the matter. :-)

However, I was simply asking if, on amd64, kencc uses the 6 registers that
the abi deserves to the parameters.
As far as I've understood only BP is used (for the first argument, if
integer).

Can you confirm?



Giacomo

2016-02-02 1:36 GMT+01:00 Charles Forsyth <charles.fors...@gmail.com>:

>
> On 1 February 2016 at 23:34, Giacomo Tesio <giac...@tesio.it> wrote:
>
>>
>> Is it correct to say that this means that the Plan9 compiler suite
>> *never* follows the sysV calling convention documented at section 3.2.3 of
>> AMD64 ABI http://www.x86-64.org/documentation/abi.pdf and always pushes
>> parameters to the stack?
>
>
> On amd64, the first parameter, if an integer, is passed in RARG, which is
> actually BP.
> The RISC machines generally pass the first parameter, if an integer, in a
> register.
>
> In general, the compiler suite never follows conventions prescribed by
> apparent maniacs.
> In particular, varargs/stdargs should (in 2000, let alone 2016) be really
> easy: lay down the ... parameters on the stack as an array in memory.
> Done. Instead ABIs give pages of filth that try to work out where things
> are for the va_x macro calls,
> because the ABI insists on following the same calling convention
> for vararg/stdarg functions as might be used for other functions with
> fixed parameters: parameter passing in registers, special rules for
> structs, special rules for structs that fit in the parameter registers,
> special rules for floating-point values. Absurd.
>


[9fans] startboot signature

2016-02-17 Thread Giacomo Tesio
Out of curiosity, why the startboot function in port/initcode.c is `void
startboot(char *argv0, char **argv)` given the argv0 is ignored?

I see that this simplify various main() in init9.s but I wonder why not
simply use `void startboot(char **argv)`


Giacomo


[9fans] Libc locks documentation

2016-03-24 Thread Giacomo Tesio
Hi, I'm a bit ignorant but I cannot recognise the algorithms in qlock.c.

Where I can find more documentation about them? Any paper I can read?

For example the rsleep/rwakeup always look a bit magic in its coupling with
qlocks. I'd really like to know more about these algorithms, but given
their use of rendezvous I can't find anything related.

Can you provide me some references?

Giacomo


Re: [9fans] Libc locks documentation

2016-03-25 Thread Giacomo Tesio
Thanks Charles!

Giacomo

2016-03-25 17:38 GMT+01:00 Charles Forsyth <charles.fors...@gmail.com>:

> If you look for "condition variables" for event notification,
> you'll find relevant material, such as this paper
> https://www.cs.berkeley.edu/~brewer/cs262/Mesa.pdf
> which has a few references in it too. There's a little evolutionary
> history of them somewhere.
>
> On 24 March 2016 at 19:56, Giacomo Tesio <giac...@tesio.it> wrote:
>
>> Hi, I'm a bit ignorant but I cannot recognise the algorithms in qlock.c.
>>
>> Where I can find more documentation about them? Any paper I can read?
>>
>> For example the rsleep/rwakeup always look a bit magic in its coupling
>> with qlocks. I'd really like to know more about these algorithms, but given
>> their use of rendezvous I can't find anything related.
>>
>> Can you provide me some references?
>>
>> Giacomo
>>
>
>


Re: [9fans] The Plan 9/"right" way to do Facebook

2016-04-03 Thread Giacomo Tesio
2016-04-03 6:42 GMT+02:00 :

> > We are already trained to be suspicious about the truth even when it's
> > clearly evident, now we can even start to ignore the information from the
> > physical world, while accepting the virtual information that someone else
> > feed us.
>
> For an Italian inheriting the legacy of Galileo Galilei, you sure
> approach Science from an odd angle.  "suspicious about the truth" is
> good, scientific behaviour.  "clearly evident" is not.
>

Theoretically, this is a very good point! :-D

But what is good for scientific research will work very badly for social
behavior and politics.

As an Italian, I also inherit the legacy of Macchiavelli and believe me:
uncertainty, indifference and divisions (and fear) are among the most
powerful tool to gain and preserve power.

I'm not afraid of people challenging mainstream opinions (this is Plan9,
isn't it? :-D), I'm afraid of people doubting about evident facts or simply
ignoring them: climatic changes? unsustainable distribution of wealth?
parents negating their kids misbehavior? inadequate legal systems for the
current world? and so on...


Giacomo
entirely off topic, sorry


Re: [9fans] The Plan 9/"right" way to do Facebook

2016-04-01 Thread Giacomo Tesio
While funny in it's visionary shape, I'm seriously scared about this matter.

Take for example Google's material design: any software that successfully
mimic the physical world (paper layers in particular) is going to bland our
perception of its "virtuality". Our mind is going to accept it as a
physical tool. Now, we "know that a programmable computer is no more and no
less than an extremely handy device for realizing any conceivable mechanism
without changing a single wire", but are we sure we really want to remove
the awareness of the wires?

Google glasses scare me even more: we are going to look the world through
some one else eyes. In the long run, our brain will start to accept the
virtual baloons like the other physical entities that really exists.

We are already trained to be suspicious about the truth even when it's
clearly evident, now we can even start to ignore the information from the
physical world, while accepting the virtual information that someone else
feed us.



Giacomo



2016-04-01 22:00 GMT+02:00 :

> lu...@proxima.alt.za writes:
>
> > I don't even remember the name of the feature, but I used a tool way
> > back in the very early days of a public Internet (it was called a MOO,
>
> > Given a browser-style interface with 3D capabilities, it would address
> > social networking considerably better than Facebook (with which I have
>
> > For that is what social media provide: a world-wide stage on which you
> > perform selections from your real life and any fantasy life you choose
>
> Very interesting.  I was envisioning a system which would (at least on
> its GUI side) present information in the form of a Web page, like
> Facebook, LinkedIn, etc.  I hadn't thought of abandoning the Web page,
> altogether, for some other kind of "social space" browser.  I wonder
> what that might be like.
>
> [Disclaimer: This is NOT a formal or serious proposal for a new Plan 9
> file system.  (Not yet, at least.)  It's just an exploration of some
> potentially possible possibilities.]
>
> For a social network to be useful, it must provide some intuitive
> mapping between information in the virtual world and its real-life
> referents.  (In contemporary social networks, these take the form of
> person/place names, mugshots, and interactive maps with balloon icons.)
> The space which humans are most familiar with navigating, of course, is
> meatspace - the physical, brick-and-mortar world.  It makes sense, then,
> that the most intuitive interface would offer some kind of three-
> dimensional virtual reality.  The simplest, most intuitive mapping
> between virtual space and meatspace would probably be to visually
> "overlay" information from the virtual space onto meatspace.  Technology
> (mostly in the form of various head-mounted glasses or goggles) already
> exists which allows a person to see what's around them, while projecting
> information ontop of what they see.  A device such as this has generally
> been called an "eye tap".  But it has a problem: when you turn your
> head, the display turns with it.  In order for the UI to be as intuitive
> as the physical world, it would have to maintain orientation with its
> physical environment.  Tracking motion of the user's head could be done
> using accellerometers, a la Oculus Rift.  Imagine a Rift with two video
> cameras on its front (to provide a binocular view on the physical world)
> that overlays a digital world ontop of the real world you see.  Virtual
> arrows could guide you where you need to go without needing directions.
> When you get near your favorite Chinese restaurant, a balloon could
> appear in your view, giving you access to information about it.  When
> GPS magic detects that a friend of yours is nearby, an friendly-looking
> arrow appears, indicating the general direction and approximate distance
> to him or her.
>
> In order for a virtual world to be useful, however, simply mimicking the
> physical world won't do; its physics must differ from the physics of the
> real world in some useful way.  If your favorite restaurant is two miles
> from your present location, for example, you won't want to walk two
> miles to find its virtual balloon.  :) Navigating the virtual space
> would require some way to stretch/pan space and time, allowing the user
> to "fly" about and move forward/backward in time within the virtual
> world, before restoring the overlay to match normal space/time.  You
> would, for example, be able to hike the trail I hiked yesterday, even
> after I got back from hiking it.  If I recorded GPS waypoints and/or
> stereoscopic video along the way, you could hike right along with me,
> having a conversation with my avatar about your favorite edible plants.
> Then, I could "rewind" time and watch your hike & conversation as well
> (assuming that you decided to share it with me).
>
> An ability to stretch/shrink distances in virtual space enables use of
> non-Euclidean volumes, as well.  

Re: [9fans] memory leaks in libmp

2017-01-18 Thread Giacomo Tesio
Oh, well, I'm sorry, I should have clarified the context a bit more. Here
it is.

The link I provided here are Jehanne issues, not Plan 9 or 9front bug
reports.
After fixing a few of them I realized that, an year from now, I won't be
able to remember why I did the change. Also, coverity could shut down and I
would have no hint.

So I started coping the coverity scan comments, as a sort of note to a
future self wondering "Why the hell I changed this code?".

The coverity comments in the Jehanne issues are NOT a proof of anything,
they are just quick reminders for Jehanne's developers.

Given that, I thought: why not share these with 9fans and 9front since they
use that code too but cannot access coverity?

Now, for Jehanne these issues were already marked as "worth considering"
(and in this case "worth fixing").
And I'm fine if you consider them false positive or even use a different
fix, since that force me to challenge my assumptions, to review the code
more and even learn from better programmers than me.
Indeed I really like your feedbacks, because you are very deep in the code
base and it usually take you seconds to understand issues that require me
days to figure out.


But these are still **Jehanne's issues**, they are shared in the hope they
helps but with no warranty! ;-)


As you note, I could do it test-driven, providing a failing test and then
fixing the test. You are right, it would be much more useful to Jehanne and
maybe to the Plan 9 ecosystem too.
But, unfortunately, I'm working alone and I do not have the energy to do
this every single time. And I'm one of those few weird people thinking that
you should not care about code coverage if you don't want to pay for a full
one.

Thus I cannot share patches that you can blindly apply, sorry.


As for the issue in question, I think it's a actually a bug. mp(2) states
that
>
> Mptobe and mptole convert an mpint to a byte array.  The
> former creates a big endian representation, the latter a
> little endian one.  If the destination buf is not nil, it
> specifies the buffer of length blen for the result.  If the
> representation is less than blen bytes, the rest of the
> buffer is zero filled.  If buf is nil, then a buffer is
> allocated and a pointer to it is deposited in the location
> pointed to by bufp. Sign is ignored in these conversions,
> i.e., the byte array version is always positive.

To my eye it should only consider bufp if buf is nil. And bufp should be
not nil in that case.

Thus the fix was simply to add an assert to make if fail fast instead of
leaking memory.

The simple reasoning I did during triage was: consider a pointer to a
struct holding both buf and its length:

 mptole(num, s->buf, s->len, nil)

it will cause the leak if the struct was just zeroed.

In this case I prefer the assert fail to the leak, so that I, as a dumb
guy, would notice the issue more rapidly.


Giacomo



2017-01-18 3:31 GMT+01:00 :

> > Still a lot of coverity defects are actually false positives.
> > I try to signal here only the actual bugs but I might be wrong, thus let
> me
> > know if you find these report useless and I will stop to annoy the list.
>
> i cannot predict the future nor tell you how to spend your time. i'm *not*
> claiming that using static code analysis to find bugs is "useless" per se.
>
> but consider the context in which problems would occur, maybe even describe
> how a bug would manifest itself in some code (thats what takes the time or
> wastes our time when you do not do this), and not just blindly present the
> coverty output as a proof.
>
> --
> cinap
>
>


Re: [9fans] Why getenv replaces \0 with spaces in the returned value?

2017-01-18 Thread Giacomo Tesio
Yes that would be a plausible explanation but actually rc does not use
getenv: it reads /env/ files directly.

I've tried to remove the loop and I can't see any issue.


Giacomo


2017-01-18 21:13 GMT+01:00 Charles Forsyth <charles.fors...@gmail.com>:
> Yes, it's the lists. Nothing will cope with \0 in a C string, so it's a good
> choice as list of string element separator.
>
> On 18 January 2017 at 19:21, Fran. J Ballesteros <n...@lsub.org> wrote:
>>
>> rc lists?
>>
>> > El 18 ene 2017, a las 17:45, Giacomo Tesio <giac...@tesio.it> escribió:
>> >
>> > Hi, last night I noticed this strange post processing in 4th edition's
>> > getenv:
>> > https://github.com/brho/plan9/blob/master/sys/src/libc/9sys/getenv.c#L34-L41
>> >
>> >seek(f, 0, 0);
>> >r = read(f, ans, s);
>> >if(r >= 0) {
>> >ep = ans + s - 1;
>> >for(p = ans; p < ep; p++)
>> >if(*p == '\0')
>> >*p = ' ';
>> >ans[s] = '\0';
>> >}
>> >
>> > Anybody know why this replacement is done?
>> > It does not seem a good fix to read/write or read/truncate races, but
>> > I can't find a better explanation.
>> >
>> >
>> > Giacomo
>> >
>>
>>
>



[9fans] out of bound access in libsec

2017-01-17 Thread Giacomo Tesio
Hi, running coverity scan on libsec it reported two defects that do not
seem false positives:

1. an out of bound access to aesXCBCmac (see
https://github.com/JehanneOS/jehanne/issues/3 )
2. an out of bound access in msgRecv, tlshand.c:1809 (see
https://github.com/JehanneOS/jehanne/issues/4 )

I verified that the code is more or less the same on 9front.
I "fixed" the first with an assert, but I'm not sure wherther passing
sizeof(m->u.finished.verify) to memset in the second is the correct
solution.

Am I missing something?


Giacomo


[9fans] memory leaks in libmp

2017-01-17 Thread Giacomo Tesio
Hi, these other two defects identified from Coverity scan that you might
find interesting:

https://github.com/JehanneOS/jehanne/issues/5
https://github.com/JehanneOS/jehanne/issues/6

NOTE: 9front's guys consider these a false positive, since both

mptole(n, nil, 0, nil);

and

mptobe(n, nil, 0, nil);

are stupid bugs in the caller.

Since, I do stupid errors often, I prefer to fix the leak.

Still a lot of coverity defects are actually false positives.
I try to signal here only the actual bugs but I might be wrong, thus let me
know if you find these report useless and I will stop to annoy the list.


Giacomo


[9fans] Why getenv replaces \0 with spaces in the returned value?

2017-01-18 Thread Giacomo Tesio
Hi, last night I noticed this strange post processing in 4th edition's
getenv: 
https://github.com/brho/plan9/blob/master/sys/src/libc/9sys/getenv.c#L34-L41

seek(f, 0, 0);
r = read(f, ans, s);
if(r >= 0) {
ep = ans + s - 1;
for(p = ans; p < ep; p++)
if(*p == '\0')
*p = ' ';
ans[s] = '\0';
}

Anybody know why this replacement is done?
It does not seem a good fix to read/write or read/truncate races, but
I can't find a better explanation.


Giacomo



[9fans] devsegment usage examples

2016-08-31 Thread Giacomo Tesio
Hi, I'm looking for an usage example of devsegment.

I cannot find anything neither in bhro's plan9 nor in 9front.

Can anybody share a real usage world example?


Giacomo


Re: [9fans] devsegment usage examples

2016-08-31 Thread Giacomo Tesio
Neat, thanks!
I wonder if a similar approach could be used to move some device drivers
out of kernel...

Btw, I did read the sample in segment(3) but I was looking for a real world
example.
What I'm trying to understand is not *how* to use devsegment, but *when* to
use it.
Which problems is it designed to solve?

Moreover, Zinq's graphics use a very smart approach, but it's specific to
9front evolution of the device with the "fixed" type.
I'm also looking for the general use case, when segments are not used for
DMA, as designed in the original Plan9.


Giacomo

2016-08-31 12:40 GMT+02:00 :

> > Hi, I'm looking for an usage example of devsegment.
> >
> > I cannot find anything neither in bhro's plan9 nor in 9front.
> >
> > Can anybody share a real usage world example?
> >
> >
> > Giacomo
>
> its just creating named segments of some shared memory.
>
> segment(3) has an example. read it.
>
> on 9front, you can also allocate physically continuous segments *and*
> get the physical base address for it :)
>
> one application for it is on the zynq. the displayport graphics is
> implemented using the fpga and userspace uses devsegment
> to allocate 5MB of physically continous memory for the framebuffer:
>
> #!/bin/rc
> rfork en
> bind -c '#g' /mnt/segment
> if(! test -d /mnt/segment/fb){
> mkdir /mnt/segment/fb
> echo 'va 0x0050 0x0050 fixed' > /mnt/segment/fb/ctl
> }
>
> bind -b '#P' /dev
> audio/pcmconv -i 'c1u32r1' -o 'c1U32r1' < ./build/out.bin > /dev/pl
>
> then some c code programs the graphics register and hands the
> loaded core the physical address for DMA.
>
> --
> cinap
>
>


Re: [9fans] Porting Idris to 9front

2017-01-13 Thread Giacomo Tesio
2017-01-13 15:05 GMT+01:00 Joe M :

> >
> > Don't you need GHC to compile Idris?
>
> http://docs.idris-lang.org/en/latest/faq/faq.html#when-will-
> idris-be-self-hosting
>
> I have the posix version of the rts working on 9front. The default C
> backend generated code compiled and runs on 9front. I generated the c
> code on linux though.
>

Can you detail the process?

I'd like to give it a try on Jehanne (which is built with gcc).


Giacomo


Re: [9fans] create/create race

2016-11-30 Thread Giacomo Tesio
2016-11-30 16:08 GMT+01:00 Charles Forsyth <charles.fors...@gmail.com>:

>
> On 30 November 2016 at 15:02, Giacomo Tesio <giac...@tesio.it> wrote:
>
>>
>> But reading that thread I can't actually see why the OEXCL path has been
>> taken instead of eliminating the race mapping the syscall to the 9p message.
>> I mean except backward compatibility.
>>
>
> I suppose you'll find out, but I'd expect that all but a handful of
> instances want the existing effect and are untroubled by any potential race.
> Given that OEXCL then seems to handle the handful, it seems a reasonable
> approach.
> The ocreate would just put the race in a different place, wouldn't it?
>

Well not exactly: I will use the new create syscall (without OEXCL support)
when I need such level of control and use ocreate with OEXCL when I do not
care about the race and want a "create or truncate" default behaviour.

But actually, I cannot see a use case where the create(2) default behaviour
can be *wanted*.
I just see many use case where it can be tollerated: the create can fail
anyway for other reasons so it does not add much complexity to the client...
But I'm probably missing something obvious: can you provide an example
where not having the truncate fallback in the syscall actually break the
program or introduce a bug. It's exactly what I'm looking for.


Giacomo


Re: [9fans] create/create race

2016-11-30 Thread Giacomo Tesio
Hi guys, I know this is a noob question, but I'd really like to understand
this aspect of the kernel design.

I'm planning to experiment on the topic, modifying chan.c so that the
semantics of create(2) match those of create(5) about existing files. I
guess that the number of callers to fix is manageable.

But since I can't see any good reason for the race being there in the first
place (except maybe backward compatibility with unix, but that was not a
problem for Plan 9 designers), I'm pretty sure I'm missing something
obvious.


So, please, do you know why the create syscall does not simply return an
error if the file already exists?
You might save me a few headache...


Thanks for your help!


Giacomo



2016-05-24 23:25 GMT+02:00 Giacomo Tesio <giac...@tesio.it>:

> I'm pretty curious about the create(2)/create(5) race described in a
> comment in namec (see https://github.com/brho/plan9/
> blob/master/sys/src/9/port/chan.c#L1564-L1603)
>
> Does anyone know or remember the reasoning behind this design?
>
> What was wrong about using the create(5) semantics for the create(2)
> syscall?
>
>
> Giacomo
>


  1   2   >