Greetings -

I’d been merrily downloading videos via extra/youtube until I got a

new MacBook Pro & too hastily upgraded to El Capitan. Among other

inconveniences I’ve had to work around because of SIP, the
``download-video’’

word now produces a permissions error:

———————————-

--- Data stack:

"FfViCWntbDQ"

IN: scratchpad download-video


Unix system call “open” failed:


Permission denied (13)


It was called with the following arguments:


"/Buckminster Fullers Jitterbug.mp4"

1537

438

———————————-


Digging into the code, I see  that ``normalize-path’’ aims at the “/’’
mount-point

as the current directory for the Unix ``open’’. But SIP won’t allow
modifying

that location without authentication, so ``download-video’’ fails.


If I wrap the code in a ``with-directory’’ combinator setting an allowable

current  directory, I’m back in business:

———————————-

IN: youtube

SYMBOL: my-youtube-prefix

my-youtube-prefix [ "/Users/cwalston/YouTube/videos" ] initialize


: download-video ( video-id -- )

    [ my-youtube-prefix get ] dip    ! ( -- path video-id )

    [ get-video-info

       [

         video-formats [ "type" of "video/mp4" head? ] find nip

         video-download-url

       ] [

           "title" of sanitize ".mp4" append download-to

       ] bi

    ] curry with-directory ;

———————————-


It’s actually nicer to be able to set a target download directory, so I
should

thank SIP for goading me out of my laziness. I haven't hunted down all the
spots

where ``normalize-path’’ may choke on the strictures of SIP, but I suspect
this

isn't the last time El Cap will bite working code.


Cheers ~cw

-- 
*~ Memento Amori*
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to