Return-Path: X-Original-To: apmail-hadoop-user-archive@minotaur.apache.org Delivered-To: apmail-hadoop-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B3BAC18C61 for ; Fri, 11 Dec 2015 22:27:47 +0000 (UTC) Received: (qmail 24832 invoked by uid 500); 11 Dec 2015 22:27:39 -0000 Delivered-To: apmail-hadoop-user-archive@hadoop.apache.org Received: (qmail 24443 invoked by uid 500); 11 Dec 2015 22:27:39 -0000 Mailing-List: contact user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list user@hadoop.apache.org Received: (qmail 24412 invoked by uid 99); 11 Dec 2015 22:27:39 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Dec 2015 22:27:39 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 05AECC0FFD for ; Fri, 11 Dec 2015 22:27:39 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.68 X-Spam-Level: X-Spam-Status: No, score=0.68 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id XvDbsh-JLUQg for ; Fri, 11 Dec 2015 22:27:31 +0000 (UTC) Received: from mail-ob0-f170.google.com (mail-ob0-f170.google.com [209.85.214.170]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id 365EF20CC6 for ; Fri, 11 Dec 2015 22:27:30 +0000 (UTC) Received: by obc18 with SMTP id 18so92929845obc.2 for ; Fri, 11 Dec 2015 14:27:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=fK4r5Qm7xDZ+AVvGRQRaWIR4i30SHyqtVWEZ6kcFdmI=; b=TN21FdawJhSY77aJcj1Pavj5LbTVSBJtn2ydcU/9wcqK8puPFzvkvOv3RUocGYFKHo LMQJLlpltkIL/V4eaf8uxvQrzuNZgkFS5emyw5Mb0tIrZGa4lpEDQCsJRxwbsNXwh89n /gLXErE/boiEoKxIiD3xDedWmDWQ6uv3hY1AWLt36eveZKIBEB8YULeR8SvImuW7KHIT KSQXH8ghmhRYBNIuSPbZ861V5cD7VIk8ZtBfefX8LNidpCH1zXcLC6Y5IRLVDdBSj2Nr HTNvuFWtxRWX6ywualZlmuAr02jUrICPxYFBiKaLaUWU/4GL3BKRx45OPu4uJb/AHCtI 6xGw== X-Received: by 10.60.54.168 with SMTP id k8mr16774888oep.51.1449872848930; Fri, 11 Dec 2015 14:27:28 -0800 (PST) MIME-Version: 1.0 Received: by 10.202.188.135 with HTTP; Fri, 11 Dec 2015 14:27:09 -0800 (PST) In-Reply-To: References: From: Samuel Date: Fri, 11 Dec 2015 23:27:09 +0100 Message-ID: Subject: Re: Dependency on absolute path /bin/ls in Shell.java To: Chris Nauroth Cc: Namikaze Minato , "user@hadoop.apache.org" Content-Type: text/plain; charset=UTF-8 Thanks for the information. If you are already aware of the problem, that is enough for me :) Best On 11 December 2015 at 18:49, Chris Nauroth wrote: > Hello Samuel, > > Issue HADOOP-11935 tracks an improvement to re-implement this code path > using either JNI to OS syscalls or the JDK 7 java.nio.file APIs (probably > the latter). > > https://issues.apache.org/jira/browse/HADOOP-11935 > > > For right now, I don't see a viable workaround besides ensuring that the > command is accessible at /bin/ls on your system. > > --Chris Nauroth > > > > > On 12/11/15, 8:05 AM, "Namikaze Minato" wrote: > >>My question was, which spark command are you using, and since you >>already did the analysis, which function of Shell.java is this spark >>code using? >> >>Regards, >>LLoyd >> >>On 11 December 2015 at 15:43, Samuel wrote: >>> I am not using hadoop-util directly, it is Spark code what uses it >>> (i,e. not directly under my control). >>> >>> Regarding ls, for my particular use case it is fine if you use "ls" >>> instead of "/bin/ls". >>> >>> However, I do agree that using ls to fetch file permissions is >>> incorrect, so a better solution (in terms of code quality) would be >>> not to use ls at all. >>> >>> >>> On 11 December 2015 at 14:56, Namikaze Minato >>>wrote: >>>> So what you ultimately need is a piece of java code listing the rwx >>>> permissions for user, group and others that is not using ls >>>> internally, is that correct? >>>> If "RawLocalFileSystem" is not HDFS, do you really need to use >>>> hadoop-util for that? >>>> Can you tell us more about your use case? >>>> >>>> Regards, >>>> LLoyd >>>> >>>> >>>> >>>> >>>> On 11 December 2015 at 13:05, Samuel wrote: >>>>>> Using ls to figure out permissions is a bad design anyway, so I would >>>>>> not be surprised if this hardcode was reported as a bug. >>>>> >>>>> Of course, I have no idea why it was implemented like this. I assume >>>>> it was written at some point in time where Java didn't provide the >>>>> needed APIS (?) >>>>> >>>>> Implementing the permission check without relying in ls at all is also >>>>> a solution for the problem I have :) >>>>> >>>>>> LLoyd >>>>>> >>>>>> On 11 December 2015 at 09:19, Samuel wrote: >>>>>> > Hi, >>>>>> > >>>>>> > I am experiencing some crashes when using spark over local files >>>>>>(mainly for >>>>>> > testing). Some operations fail with >>>>>> > >>>>>> > java.lang.RuntimeException: Error while running command to get file >>>>>> > permissions : java.io.IOException: Cannot run program "/bin/ls": >>>>>>error=2, No >>>>>> > such file or directory >>>>>> > at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) >>>>>> > at org.apache.hadoop.util.Shell.runCommand(Shell.java:206) >>>>>> > at org.apache.hadoop.util.Shell.run(Shell.java:188) >>>>>> > at >>>>>> > >>>>>>org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:3 >>>>>>81) >>>>>> > at org.apache.hadoop.util.Shell.execCommand(Shell.java:467) >>>>>> > at org.apache.hadoop.util.Shell.execCommand(Shell.java:450) >>>>>> > at >>>>>> > >>>>>>org.apache.hadoop.fs.RawLocalFileSystem.execCommand(RawLocalFileSystem >>>>>>.java:593) >>>>>> > at >>>>>> > >>>>>>org.apache.hadoop.fs.RawLocalFileSystem.access$100(RawLocalFileSystem. >>>>>>java:51) >>>>>> > at >>>>>> > >>>>>>org.apache.hadoop.fs.RawLocalFileSystem$RawLocalFileStatus.loadPermiss >>>>>>ionInfo(RawLocalFileSystem.java:514) >>>>>> > at >>>>>> > >>>>>>org.apache.hadoop.fs.RawLocalFileSystem$RawLocalFileStatus.getPermissi >>>>>>on(RawLocalFileSystem.java:489) >>>>>> > at >>>>>> > >>>>>>org.apache.spark.sql.parquet.ParquetRelation2$$anonfun$buildScan$1$$an >>>>>>on$1$$anonfun$12.apply(newParquet.scala:292) >>>>>> > >>>>>> > etcetera... >>>>>> > >>>>>> > Which seems to be related to Shell.java in org.apache.hadoop-util, >>>>>>that uses >>>>>> > ls -ld to figure out file permissions (that is in >>>>>> > RawLocalFileSystem.loadPermissionsInfo). The problem is that >>>>>>instead of just >>>>>> > calling ls, Shell .java calls /bin/ls, which is usually available, >>>>>>but in >>>>>> > certain circumstances might not. Regardless of the reasons not to >>>>>>have ls in >>>>>> > /bin, hardcoding the directory bans users from using the standard >>>>>>mechanisms >>>>>> > to decide which binaries to run in their systems (in this case, >>>>>>$PATH), so I >>>>>> > wonder if there is a particular reason why that path has been >>>>>>hardcoded to >>>>>> > an absolute path instead to something resolvable using$PATH. >>>>>> > >>>>>> > Or in other words, is this a bug or a feature? >>>>>> > >>>>>> > Best >>>>>> > >>>>>> > -- >>>>>> > Samuel >>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Samuel >>> >>> >>> >>> -- >>> Samuel >> >>--------------------------------------------------------------------- >>To unsubscribe, e-mail: user-unsubscribe@hadoop.apache.org >>For additional commands, e-mail: user-help@hadoop.apache.org >> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@hadoop.apache.org > For additional commands, e-mail: user-help@hadoop.apache.org > -- Samuel --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@hadoop.apache.org For additional commands, e-mail: user-help@hadoop.apache.org